LogiQuest

135. Digital Root

EasyDigitsModular Arithmetic

Repeatedly sum the digits of n until one digit remains. Print it.

Input format

A single non-negative integer n (up to 10⁵ digits).

Output format

The digital root.

Example 1

Input

38

Output

2

Example 2

Input

0

Output

0

Constraints

0 ≤ n

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…