Watson and Digit Sums

All submissions for this problem are available.
Watson is going to play mind games with Sherlock. He gives an integer d to Sherlock.
Among all possible positive integers N having sum of digits d, consider the integer N+1, and find the minimum possible digit sum N+1 can have.
For example, if d = 9, then N could be 9, 18, 27, 36,711 and so on. However, if Sherlock chooses N = 9, then sum of digits of N + 1 i.e. 10 will be 1, which is the minimum possible.
Input
First line of the input contains an integer T, the number of test cases.
The only line of each test case consists of an integer d.
Output
For each test case output the required answer in one line.
Constraints
 1 ≤ T ≤ 100
 1 ≤ d ≤ 100000
Example
Input: 1 5 Output: 6
Explanation
Possible value of N in given case are: 32,23,113,131 and so on, in each case digit sum of (N+1) would be 6.
Author:  admin3 
Tags  admin3 
Date Added:  18102016 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 