eolymp
bolt
Try our new interface for solving problems
Problems

License Software

License Software

As you know, to verify the licensed software used by the serial number and reshistratsionnye keys. You, as a leading developer of verification of license software was developed the idea of reliable in-a-kind system. It Is based on the digital roots of numbers. Now you need to write a program that defines the digital root of this number. For an arbitrary number of digital root is defined as follows: \begin{enumerate} \item If the amount is less than ten-digit number, then the digital root is the sum of digits of that number. \item Otherwise, the digital root of a number equal to the digital root of the sum of its digits. \end{enumerate} \textbf{Input } One number \textbf{n} (\textbf{0} ≤ \textbf{n }≤ \textbf{2^31}^\{ \}- \textbf{1}). \textbf{Output} Print one number - the answer to the challenge.
Time limit 1 second
Memory limit 128 MiB
Input example #1
123
Output example #1
6