IIITD1 - Those College Days!


Once there was a Shikaari in IIIT Delhi campus and he was famous for his Shikaar techniques. Also there was Kalakhatta who was jealous of Shikaari’s charisma. Once Kalakhatta challenged Shikaari to test his knowledge. Now Shikaari’s afraid of losing, would you help?

You are given a number N and you have to increment the most significant digit without changing any other number in N. You can do this by adding a positive number X.

Input

The first line of the input consist of a single integer number T which determines the number of tests.

In each of next t lines there is a single integer number N.

Constraints

  • 0 < t ≤ 105
  • | n | ≤ 109

Output

Print the minimum number X in separate lines.

Example

Input:
2
5
15

Output:
1
10

hide comments
vas14: 2021-11-16 21:29:02

If the input number is negative, it expects you to drop the negation sign, increment the digit, and output the difference of the latter and the original negative number.

rjd302: 2018-10-07 18:29:29

@deathgun can you please check my submission

satyamlal2209: 2018-06-26 16:29:39

Are there any test cases i might have missed? apart from that -1 case?

ajayc1007: 2018-01-08 17:37:11

C++14 (gcc 6.3) => Wrong ans,
C++ (g++ 4.3.2) => AC :(
venkat016 MASS!!!!!!!!

Last edit: 2018-01-08 20:32:19
venkat016: 2018-01-07 17:12:50

Thanks to @prasad_235

Last edit: 2018-01-07 21:03:40
anurag garg: 2017-08-12 10:47:45

Any tricky test cases?

amulyagaur: 2017-07-26 20:25:00

AC in 1 go :)

kooljais24: 2017-06-20 01:03:59

@stcsteven it's not mainly about the negetive sign as MSD.

sharonbarak: 2017-06-10 19:13:35

Why is x = 3 for n = -1?


Added by:deathgun
Date:2017-05-30
Time limit:0.200s-0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Original