#K79667. Single Digit Sum

    ID: 35360 Type: Default 1000ms 256MiB

Single Digit Sum

Single Digit Sum

You are given a large non-negative integer N represented as a string. Your task is to repeatedly calculate the sum of its digits until a single digit is obtained. This process is known as obtaining the digital root of the number.

Formally, if the sum of the digits of N is greater than 9, then replace N with this sum and repeat the process. The process stops when the resulting number has only one digit.

Note: The summing process can be expressed in LaTeX as follows:

$$ \text{Let } S(N) = \sum_{i=1}^{|N|} d_i. \quad \text{If } S(N) > 9, \text{ set } N = S(N) \text{ and repeat.} $$

inputFormat

The input consists of a single line that contains the large integer N represented as a string. Note that N may contain leading zeros.

outputFormat

Output a single digit—the result of repeatedly summing the digits of N until only one digit remains. You should print the result to stdout.

## sample
9876543210
9

</p>