Skip to content
UPEEC

Digital Root

Easy#math#digits· solved by 0 · time limit 2.0 s

Repeatedly replace nn by the sum of its digits until a single digit remains. Print that digit.

Input

A single integer nn.

Output

The digital root.

Constraints

0≤n≤10180 \le n \le 10^{18}

Sample 1

Input

9875

Output

2

Sample 2

Input

0

Output

0

Sign in or join free to run and submit your solution.