N = int(input().strip()) for x in range(100): total = 0 for n in str(N): total += int(n) N = total print(N)