#K53102. Digital Root Sum

    ID: 29457 Type: Default 1000ms 256MiB

Digital Root Sum

Digital Root Sum

Given a large positive integer represented as a string, your task is to compute its digital root. The digital root of a number is obtained by repeatedly summing its digits until a single-digit number remains.

You can express the digital root mathematically as follows:

\( dr(n) = \begin{cases} 0, & \text{if } n = 0 \\ 1 + ((n - 1) \mod 9), & \text{if } n > 0 \end{cases} \)

However, for this problem you are required to implement the iterative process of summing the digits until there is only one digit left.

inputFormat

The input consists of a single line containing a large positive integer represented as a string. The number may be very large, so you should not assume it fits into a standard numerical type.

outputFormat

Output the single-digit digital root of the input number.

## sample
9875
2