eolymp
bolt
Try our new interface for solving problems
Problems

Assignment of Nicholas

Assignment of Nicholas

\includegraphics{https://static.e-olymp.com/content/fa/fa7d3a2ad91439ec3a43d9ab0fd8394e5d496b1f.gif} Approaching New Year! Third graders are already dreaming to go near the Christmas tree in Kiev. Teacher of Mathematics, one with a \textbf{3}-class city of Alexandria, they were informed that she could took on tree in Kiev only those students who solve puzzle of St. Nicholas. He wants to know the \textit{quality} of a given number. According to Nicholas, the quality of the number \textbf{N} is the sum of digits of all positive integers \textbf{A} is not very large number \textbf{N} such that the remainder of the division of \textbf{N} by the number of \textbf{A} is \textbf{0}. \InputFile The first line contains an integer \textbf{N (N <= 100)} -- the number of students in the \textbf{3} rd grade. In the next\textbf{N} lines available jobs for each student: a natural number not more than \textbf{15 000 000} (Nicholas decided to spare the students and the number selected is not very large). \OutputFile For each of the numbers given by Nicholas to his disciples, indicate its quality.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1
970481
Output example #1
30
Author Mark_tven