N = input() for _ in range(100): next_num = 0 for c in N: next_num += int(c) N = str(next_num) print(N)