N = int(input()) for i in range (0, 100): M = str(N) N = 0 for i in range (0, len(M)): N+=int(M[i]) print(N)