#C4508. Calculate the Digit Root
Calculate the Digit Root
Calculate the Digit Root
Given a non-negative integer \(n\), compute its digit root by repeatedly summing its digits until a single-digit number is obtained. More formally, if \(n\) is expressed in its decimal representation as \(n = d_k d_{k-1} \ldots d_1\), then the digit root is obtained by computing:
\(n_1 = d_k + d_{k-1} + \cdots + d_1\), and if \(n_1 \ge 10\) then continue the process until a single-digit number is reached.
For example, for \(n = 456\):
\(4+5+6=15\) and then \(1+5=6\), so the digit root is 6.
inputFormat
The input consists of a single non-negative integer \(n\) on one line. You may assume that \(0 \le n \le 10^{18}\).
outputFormat
Output one line containing the digit root of \(n\).
## sample456
6
</p>