SPCQ - Gopu and Digits Divisibility

One day Little Gopu was playing with numbers. As he is little boy, he was wondering about divisibility rules that how they apply and what is the logic behind them. Few days ago he has also learnt how to find sum of digits of a number. 

He thought about finding the smallest number greater than or equal to n, which is a "nice" number. A number is called "nice" if it is divisible by sum of its digits. He is unable to solve this puzzle. Can you write a program to help the Little Gopu?

eg. if n = 11, 11 is not divisible by 1 + 1 = 2, But 12 is divisible by 1 + 2 = 3. So answer for case n = 11 should be 12.

Input

First line contains T : number of test cases. (1 ≤ T ≤ 104).

For each test case, It contains a single integer n in a line, (1 ≤ n ≤ 1018).

Output

For each test case, output the smallest "nice" number greater or equal to n.

Example

Input:
3
11
22
2 Output: 12
24

Added by:praveen123
Date:2013-12-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:IITK ACA CSE online judge

hide comments
2022-01-16 12:56:46
i got 3 WA's with long long use unsigned long long for AC in c++
2020-04-25 09:22:15
Don't even think about constraint, just Do it :)
2020-02-20 19:34:03
don't, think just do.
2018-09-25 19:51:06
well just do what the question says implementation question
2018-08-31 15:36:51
simple one..
2018-07-30 15:15:26
Test cases and time limit weak enough to accept naive python 3 solution.
Mixed feelings about this but AC is AC ;)
2018-02-02 05:33:04
very weak test cases
2018-01-12 10:05:13
brute force is enough! ac in on go
2017-06-04 16:37:35
100th :D :D
2017-06-03 19:25:28
simple brute force got accepted
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.