#include <stdio.h>
int main(void) {
int n ;
int j;
int sum =0;
j=n;
for(; sum!=1 ;){
n = sum;
sum = 0;
while(n!=0){
sum = sum+ n%10*n%10;
n=n/10;
}
if(sum==j)
if(sum==1)
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CglpbnQgbiA7CglpbnQgajsKCWludCBzdW0gPTA7CglzY2FuZigiJWQiLCZuKTsKCWo9bjsKCglmb3IoOyBzdW0hPTEgOyl7CgkJbiA9IHN1bTsKCQlzdW0gPSAwOwoJCXdoaWxlKG4hPTApewoJCXN1bSA9IHN1bSsgbiUxMCpuJTEwOwoJCW49bi8xMDsKCQl9CgkJaWYoc3VtPT1qKQoJCXByaW50Zigi44Ki44Oz44OP44OD44OU44O844OK44Oz44OQ44O8Iik7YnJlYWs7CgkJaWYoc3VtPT0xKQoJCXByaW50Zigi44OP44OD44OU44O844OK44Oz44OQ44O8Iik7YnJlYWs7CgkJCgkJCgkJCgkJfQoJcmV0dXJuIDA7Cn0K