Time

11:57:26
11 Feb 2012
ACM-ICPC Thailand Southern Region Programming Contest 2011
Left: 3 hours 3 minutes
End: 11.02.2012 15:00
Leader: Informatimukas
Five for week 22
Left: 10 hours 3 minutes
End: 11.02.2012 22:00
Leader: NuM
Version for print

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:

  1. If the amount is less than ten-digit number, then the digital root is the sum of digits of that number.
  2. Otherwise, the digital root of a number equal to the digital root of the sum of its digits.

Specifications

   Input

   One number n (0n 231 - 1). 

   Output

   Print one number - the answer to the challenge.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 4.7619
Complexity: 17% 422/509
Classes: Simple mathematics

Example

Example input

123

Example output

6


← Martian King Problems Chain fraction (RU) →