Код:
var a,b:string; x,y,z:array [1..1001] of integer; i,f,nx,ny,nz:longint; begin readln(a); readln(b); nx:=length(a); ny:=length(b); for i:=1 to nx do val(a[i],x[nx-i+1],f); for i:=1 to ny do val(b[i],y[ny-i+1],f); if nx>ny then nz:=nx else nz:=ny; for i:=1 to nz do begin z[i]:=z[i]+y[i]+x[i]; if z[i]>9 then begin z[i]:=z[i] mod 10;z[i+1]:=1;end; end; if z[nz+1]<>0 then nz:=nz+1; for i:=nz downto 1 do write(z[i]); end.