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