DMCA (Codeforces 1505B)
Tags: Implement, *special

Many people are aware of DMCA – Digital Millennium Copyright Act. But another recently proposed DMCA – Digital Millennium Calculation Act – is much less known.In this problem you need to find a root of a number according to this new DMCA law.

Input: The input contains a single integer $$$a$$$ ($$$1 \le a \le 1000000$$$).

Output: Output the result – an integer number.


Sample Inputs:
1

81

Sample Outputs:
1

9

Solution (Python):
print((int(input()) - 1) % 9 + 1)

Solution (Python):
s = input()

def sum_digits(s):
    return str(sum([int(c) - int('0') for c in s]))
while len(s) > 1:
    s = sum_digits(s)
print(s)

Solution (Python):
n = list(input())
while len(n) > 1:
    e = sum(list(map(int, n)))
    n = list(str(e))
print(*n)