(while(print([rec(f x e)(mod(if(= e 0)x(if(odd? e)(*(f x(- e 1))x)(f(mod(* x x)10)(/ e 2))))10)](read)(read))))