Assignment of Nicholas#517

Assignment of Nicholas

1 second
64 megabytes
Very easy

Approaching New Year! Third graders are already dreaming of going near the Christmas tree in Kiev. The Mathematics teacher, who works with the third-grade class in the city of Alexandria, informed the students that she could take to the tree in Kiev only those students who solve the puzzle of St. Nicholas. Nicholas wants to know the quality of a given number.

According to Nicholas, the quality of the number is the sum of the digits of all positive integers not greater than the number such that the remainder of the division of by the number is .

Input

The first line contains an integer (N \leq 100) — the number of students in the third grade. In the next lines, there are the numbers for each student: a natural number not greater than (Nicholas decided to spare the students by choosing not very large numbers).

Output

For each of the numbers given by Nicholas to his students, output its quality.

Examples

Example 1

Loading
Loading