Digital root#3937

Digital root

1 second
128 megabytes
Very easy

The digital root of a number is defined as follows: 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 the smaller number first.

Input

One line contains the array elements. The length of array is no more than , each number is positive and does not exceed 10^9.

Output

Print the elements of array sorted in increasing order of their digital roots.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading