#K46712. Digital Root Computation

    ID: 28038 Type: Default 1000ms 256MiB

Digital Root Computation

Digital Root Computation

Given a non-negative integer \(N\), compute its digital root. The digital root is obtained by repeatedly summing the digits of \(N\) until a single-digit number is reached. More formally, for any non-negative integer \(N\), the digital root \(dr(N)\) is defined as:

[ dr(N) = \begin{cases} N, & \text{if } N < 10, \ dr\Big(\sum_{d \in \text{digits}(N)} d\Big), & \text{if } N \geq 10. \end{cases} ]

Your task is to implement the digital root computation. The input will be provided via standard input and the result should be printed via standard output.

inputFormat

The input consists of a single line containing a non-negative integer \(N\) (\(0 \leq N \leq 10^{9}\)). The number is provided via standard input.

outputFormat

Output a single integer which is the digital root of \(N\). The output should be printed to standard output.

## sample
16
7