#K83267. Digital Root
Digital Root
Digital Root
Given a non-negative integer n (with \(1 \le n \le 10^6\); note that 0 is allowed in some test cases), compute its digital root. The digital root of a number is obtained by repeatedly summing its digits until a single-digit number is produced.
This process is formally defined as follows:
$$ \text{dr}(n)=\begin{cases} n, & \text{if } n<10,\\ \text{dr}\Big(\sum_{d\in\text{digits}(n)} d\Big), & \text{otherwise.} \end{cases} $$
Input is provided via standard input and the result should be printed to standard output.
inputFormat
The input consists of a single line containing one integer n.
outputFormat
Output a single integer, which is the digital root of n.
## sample16
7