program sqrttt; {$APPTYPE CONSOLE} uses SysUtils; type long=array[0..10000] of integer; var s:string; a1,b1,c1,d1:long; n,i,k:integer; 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 por(a,b:long):boolean; var i:integer; p:boolean; begin p:=false; if a[0]>b[0] then p:=true; if a[0]=b[0] then begin i:=a[0]; while a[i]=b[i] do i:=i-1; if (a[i]>b[i]) and (i>0) then p:=true; if i<1 then p:=true; end; por:=p; end; function vid(a,b:long):long; var c:long; i:integer; begin if a[0]>b[0] then c[0]:=a[0] else c[0]:=b[0]; for i:=1 to c[0] do begin if a[i]>=b[i] then c[i]:=a[i]-b[i] else begin a[i+1]:=a[i+1]-1;c[i]:=a[i]+10-b[i]; end; end; while c[c[0]]=0 do c[0]:=c[0]-1; if c[0]<=0 then c[0]:=1; vid:=c; end; function dob(a,b:long):long; var d,c:long; des,temp,j,i:integer; begin des:=0;temp:=0; for i:=0 to 10000 do d[i]:=0; for i:=0 to 10000 do c[i]:=0; 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; for i:=0 to c[0] do c[i]:=0; end; dob:=d; end; begin readln(s); a1[0]:=length(s); for i:=a1[0] downto 1 do a1[i]:=strtoint(s[a1[0]-i+1]); //for i:=a1[0] downto 1 do write(a1[i]); writeln; c1[0]:=1; if a1[0]>3 then c1[0]:=a1[0] div 2-1; c1[c1[0]]:=1; d1[0]:=1;d1[1]:=1; while por(a1,b1) do begin b1:=dob(c1,c1); //for i:=c1[0] downto 1 do write(c1[i]);readln; //for i:=b1[0] downto 1 do write(b1[i]);readln; c1:=sum(c1,d1); end; c1:=vid(c1,d1); c1:=vid(c1,d1); for i:=c1[0] downto 1 do write(c1[i]);writeln; readln; end.