#C13468. Digital Root Calculation
Digital Root Calculation
Digital Root Calculation
The digital root of a non-negative integer \(n\) is the single digit obtained by iteratively summing the digits of \(n\) until only one digit remains.
For example, the digital root \(f(n)\) is defined as follows:
\( f(n) = \begin{cases} n, & \text{if } n < 10 \\ f\Big(\sum_{\text{digits}} n\Big), & \text{if } n \ge 10 \end{cases} \)
Your task is to write a program that takes an integer as input and outputs its digital root.
inputFormat
The input consists of a single line containing one non-negative integer \(n\) (\(0 \leq n \leq 2^{31}-1\)).
outputFormat
Output a single line containing the digital root of \(n\).
## sample0
0
</p>