#yuki1168 n=int(input()) def f(x): s=0 while x>0: s+=x%10 x//=10 return(s) y=f(n) for i in range(100): z=f(y) y=z print(z)