{$apptype console} type long=array[0..10000] of integer; var a,b,by,aa,bb:long; ax,I,x,y,r:integer; procedure per(var a:long); var i,temp:integer; begin for i:=1 to a[0] div 2 do begin temp:=a[i]; a[i]:=a[a[0]-i+1]; a[a[0]-i+1]:=temp; end; end; // виведення procedure vuvid (a:long); var i:integer; begin for i:=a[0] downto 2 do write(a[i]); writeln(a[1]); end; // // порівняння function por(a,b:long):boolean; var i:integer; begin if a[0]b[0] then por:=false; if a[0]=b[0] then begin i:=a[0]; while(a[i]=b[i]) and (i>1) do i:=i-1; if a[i]<=b[i] then por:=true else por:=false; end; end; //--------------сума function sum(a,b:long):long; var c:long; os,i:integer; begin if a[0]>b[0] then c[0]:=a[0] else c[0]:=b[0]; os:=0; for i:=1 to c[0] do begin c[i]:=(a[i]+b[i]+os) mod 10; os:=(a[i]+b[i]+os) div 10; end; if os>0 then begin c[0]:=c[0]+1;c[c[0]]:=os;end; sum:=c; end; function dobk(a:long;b:integer):long; var c:long; os,i:integer; begin c[0]:=a[0]; os:=0; for i:=1 to c[0] do begin c[i]:=(a[i]*b+os) mod 10; os:=(a[i]+b+os) div 10; end; if os>0 then begin c[0]:=c[0]+1;c[c[0]]:=os;end; dobk:=c; end; // віднімання function riz(a,b:long):long; var c:long; os,i:integer; begin c[0]:=a[0]; for i:=1 to c[0] do if a[i]>=b[i] then c[i]:=a[i]-b[i] else begin c[i]:=10+a[i]-b[i]; a[i+1]:=a[i]-1; end; while c[c[0]]=0 do c[0]:=c[0]-1; riz:=c; end; //--------------добуток function dob(a,b:long):long; var d,c:long; des,temp,j,s,i:integer; begin for i:=0 to 3000 do c[i]:=0; for i:=0 to 3000 do d[i]:=0; for j:=1 to b[0] do begin des:=0; c[0]:=a[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; for i:=1 to c[0] do c[i]:=0; end; dob:=d; for i:=0 to d[0] do d[i]:=0; end; //---------ділення function dil(a:long;b:integer):long; var os,i:integer; c:long; begin os:=0; for i:=a[0] downto 1 do begin c[i]:=(a[i]+os*10) div b; os:=(a[i]+os*10) mod b; end; c[0]:=a[0]; while c[c[0]]=0 do c[0]:=c[0]-1; {00000} dil:=c; end; begin readln(a[0]);for i:=1 to a[0] do read(a[i]); //a[i]:=random(9)+1; {a[0]:=6; a[1]:=1; a[2]:=3; a[3]:=8; a[4]:=3; a[5]:=8; a[6]:=4;} if a[0] mod 2=1 then begin for i:=a[0] downto 1 do a[i+1]:=a[i]; a[0]:=a[0]+1; a[1]:=0; END; for i:=1 to a[0] do write(a[i]); writeln; b[0]:=0; i:=1; b[0]:=b[0]+1; b[b[0]]:=trunc(sqrt(a[i]*10+a[i+1])); R:=a[i]*10+a[i+1]-sqr(b[b[0]]); AA[0]:=3; AA[1]:=R;AA[2]:=a[i+2];AA[3]:=a[i+3]; AX:=2*b[b[0]]; b[0]:=b[0]+1; for x:=0 to 9 do if (ax*10+x)*x<=AA then b[b[0]]:=x; AX:=AX*10+b[b[0]]; i:=5; // cikl while i