n=int(input()) for i in range(100): N=str(n) n=0 for j in N: n+=int(j) print(n)