Time limit
2s
Memory limit
128 MB
Given a positive integer, add all of its decimal digits. If the result still has two or more digits, repeat the same operation. The final one-digit value is the result of the game.
For each number you are given, compute this final one-digit value.
Each line contains an integer N. N is a positive integer less than 100000.
The input ends with a line containing 0. Do not output anything for this final 0.
For each input number before the final 0, print its one-digit result on its own line.