Digital root
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
The digital root of a number is defined next way: we take the sum of digits of , then the sum of digits of obtained number and so on until we get one digit number.
You must sort the elements of array in increasing order of their digital roots. If the digital roots are equal, put first the less number.
Input
One line contains the array elements. The length of array is no more than , each number is positive and does not exceed .
Output
Print the elements of array sorted in increasing order of their digital roots.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 1K
Acceptance rate 42%