var c:char;
res,temp,op:int64;
begin
assign(input,*expr10.in*);
assign(output,*expr10.out*);
reset(input);
rewrite(output);
read(c);
res:=0;temp:=1;
op:=0;
while ((c>=*0*)and(c<=*9*))or(c=*+*)or(c=***)
do begin
if c in[*0*..*9*] then op:=(op*10+ord(c)-ord(*0*))mod 10000;
if (c=*+*) then begin
temp:=(temp*op)mod 10000;
res:=(res+temp)mod 10000;
op:=0;
temp:=1;
end;
if (c=***) then begin
temp:=(temp*op)mod 10000;
op:=0;
end;
read(c);
end;
temp:=(temp*op)mod 10000;
res:=(res+temp)mod 10000;
writeln(res);
close(input);
close(output);
end.
res,temp,op:int64;
begin
assign(input,*expr10.in*);
assign(output,*expr10.out*);
reset(input);
rewrite(output);
read(c);
res:=0;temp:=1;
op:=0;
while ((c>=*0*)and(c<=*9*))or(c=*+*)or(c=***)
do begin
if c in[*0*..*9*] then op:=(op*10+ord(c)-ord(*0*))mod 10000;
if (c=*+*) then begin
temp:=(temp*op)mod 10000;
res:=(res+temp)mod 10000;
op:=0;
temp:=1;
end;
if (c=***) then begin
temp:=(temp*op)mod 10000;
op:=0;
end;
read(c);
end;
temp:=(temp*op)mod 10000;
res:=(res+temp)mod 10000;
writeln(res);
close(input);
close(output);
end.