level 2
program aa;
var
s1,s2:ansistring;
procedure cheng;
var l,n,y,z:longint;
x:int64;
s3:string;
begin
l:=length(s1);
n:=0;
while n<l do
begin
n:=n+1;
if s1[n] in [*0*..*9*] then x:=x*10+ord(s1[n]);
if s1[n]=*** then begin y:=x; z:=1; x:=0; end;
if (z=1) and ((s1[n]=*+*)or(s1[n]=***)) then begin x:=x*y; z:=0; end;
if s1[n]=*+* then begin str(x,s3); s2:=s2+* *+s3; x:=0; end;
end;
end;
procedure jia;
var l,n,k,z:longint;
i:integer;
s:string;
a:array[1..4] of 0..9;
x,y:int64;
begin
l:=length(s2);
n:=0;
while n<l do
begin
n:=n+1;
if s2[n] in [*0*..*9*] then x:=x*10+ord(s2[n]);
if s2[n]=* * then begin y:=x; z:=1; x:=0; end;
if (z=1) and (s2[n]=* *) then begin y:=x+y; z:=0; end;
end;
if y<10000 then begin write(y); halt; end;
for i:=1 to 4 do
begin
z:=y mod 10;
y:=y div 10;
a[i]:=z;
end;
n:=0;
for i:=4 downto 1 do n:=n*10+a[i];
write(n);
end;
begin
readln(s1);
cheng;
jia;
end.
2014年09月16日 12点09分
4