#C3491. Digital Root Calculation

    ID: 46924 Type: Default 1000ms 256MiB

Digital Root Calculation

Digital Root Calculation

Given a non-negative integer (N), your task is to compute its digital root. The digital root is obtained by repeatedly summing the digits of (N) until a single digit is achieved. Formally, if (N < 10) then the digital root is (N), otherwise compute (N = \text{sum_of_digits}(N)) until (N) is a single digit. For example, if (N = 38), then the process is: (3+8=11) and then (1+1=2); the final answer is (2).

inputFormat

The input consists of a single integer (N) provided via standard input.

outputFormat

Output a single digit representing the digital root of (N) via standard output.## sample

5
5