Given an integer n, we can compute the digital root of n by summing up all the digits of n and repeating that process on the result until reaching a single digit. The digital sum of a number is the result of an iterative process of summing the digits of the number. You are asked to write a program that would calculate the digital root of a number.

Input

The input contains a single integer n (0 ≤ n ≤ ).

Output

The program should print the digital root of the number n.