program mult_long; {$APPTYPE CONSOLE} var a,b,c,d:array[0..1000] of integer; j,temp,i:integer; f:text; ch:char; des:integer; begin assign(f,'long3.dat'); reset(f); for i:=0 to 1000 do a[i]:=0; for i:=0 to 1000 do b[i]:=0; while not(eoln(f)) do begin read(f,ch); if ch in ['0'..'9'] then begin for i:=a[0] downto 1 do a[i+1]:=a[i]; a[0]:=a[0]+1; a[1]:=ord(ch)-ord('0'); end; end; for i:=0 to 1000 do b[i]:=0; while not(eof(f)) do begin read(f,ch); if ch in ['0'..'9'] then begin for i:=b[0] downto 1 do b[i+1]:=b[i]; b[0]:=b[0]+1; b[1]:=ord(ch)-ord('0'); end; end; close (f); for j:=1 to b[0] do begin c[0]:=a[0]; des:=0; for i:=1 to c[0] do begin c[i]:=(a[i]*b[j]+des) mod 10; des:=(a[i]*b[j]+des) div 10; end; if des>0 then begin c[0]:=c[0]+1;c[c[0]]:=des;end; for i:=c[0] downto 1 do c[i+j-1]:=c[i]; c[0]:=c[0]+j-1; for i:=1 to j-1 do c[i]:=0; if c[0]>=d[0] then d[0]:=c[0]; des:=0; for i:=1 to d[0] do begin temp:=(c[i]+d[i]+des) mod 10; des:=(c[i]+d[i]+des) div 10; d[i]:=temp; end; if des>0 then begin d[0]:=d[0]+1;d[d[0]]:=des;end; end; assign(f,'long3.sol'); rewrite(f); for i:=d[0] downto 1 do write(f,d[i]); close(f); end.