该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
var
w,i,l,j,d1,d2,d,l1,l2,x2,x1,num,f:longint;
st,s1,s2,s,ans:string;
a1,a2:array[1..20]of longint;
k1,k2:int64;
begin
readln(st);
w:=pos(' ',st);
l:=length(st);
j:=0;
d1:=0;d2:=0;
s1:='';s2:='';
for i:=1 to w-1 do
if st[i]='.' then begin d1:=i;end;
for i:=w+1 to l do
if st[i]='.' then begin d2:=i-w;end;
if d1
then begin
d:=d2;
for i:=1 to d-d1 do a1[i]:=0;
for i:=1 to d1-1 do a1[i+d-d1]:=ord(st[i])-48;
for i:=d1+1 to w-1 do a1[d+i-d1-1]:=ord(st[i])-48;
l1:=d+w-1-d1-1;
for i:=w+1 to d2+w-1 do a2[i-w]:=ord(st[i])-48;
for i:=d2+w+1 to l do a2[i-1-w]:=ord(st[i])-48;
l2:=l-1-w;
end
else begin
d:=d1;
for i:=1 to d1-1 do a1[i]:=ord(st[i])-48;
for i:=d1+1 to w-1 do a1[i-1]:=ord(st[i])-48;
l1:=w-2;
for i:=1 to d-d2 do a2[i]:=0;
for i:=w+1 to d2+w-1 do a2[i+d-d2-w]:=ord(st[i])-48;
for i:=d2+w+1 to l do a2[i+d-d2-1-w]:=ord(st[i])-48;
l2:=l+d-d2-1-w;
end;
if l1>l2
then begin l:=l1;for i:=l2+1 to l1 do a2[i]:=0;end
else begin l:=l2;for i:=l1+1 to l2 do a1[i]:=0;end;
for i:=1 to l do
begin
s1:=s1+chr(a1[i]+48);
s2:=s2+chr(a2[i]+48);
end;
val(s1,k1);
val(s2,k2);
num:=k1 mod k2;
str(num,s);
ans:='';
w:=l-d+1;
j:=0;
for i:=length(s) downto 1 do
begin
if j=w then ans:='.'+ans;
ans:=s[i]+ans;
inc(j);
end;
if j
then begin
while j
begin
ans:='0'+ans;
inc(j);
end;
end;
if j=w
then begin
ans:='0.'+ans;
end;
s:='';
f:=0;
for i:=length(ans) downto 1 do
if f=0
then begin
if ans[i]<>'0'
then begin
s:=ans[i]+s;
f:=1;
end;
end
else s:=ans[i]+s;
writeln(s);
end.