In the number, the number of units was counted, in the resulting number, the number of units was again calculated, etc.
For example: 111211121112111 - 12 - 1 - 1 - 1 - ...
As a result, the resulting sequence stabilized. What number?
For example, the sequence 111211121112111 - 12 - 1 - 1 - 1 - ... has stabilized on the number 1.
Input
One natural number is entered, consisting of no more than 100 digits.
Imprint
Output the number on which the sequence has stabilized.
Examples
# |
Input |
Output |
1 |
12345 |
1 |
2 |
2007 |
0 |