.


           


n : integer;

var

a : longint;

{----------------------------------------------------------------------------------------}

Function c(a : integer) : longint;

var

s, z : integer;

begin

z := 0;

repeat

s := a mod 10;

z := z + s;

a := a div 10

until s = 0;

c := z

end;

{----------------------------------------------------------------------------------------}

begin

a := 7;

n := 1;

while n <= 1000 do

begin

a := c(a*a);

n := n + 1

end;

writeln(n - 1, '- ', a)

end.