Guess it

4

1 votes
Problem

Gazi is a very talented mathematician, recently he discovered the majestic power of the number '9' so he wants to play a game with you. He tells you to pick any real integer [from 10 to 10^200], then subtract sum of digits of this number from the number itself. You will get another number, now omit any digit from this number then tell Gazi the final number obtained and he will tell you the number you omitted. For example: you picked number: 2181 step1) 2181-(2+1+8+1)=2181-12=2169 step2) omit any number from 2169, say 1 i.e,2_69(=final number=F) tell this number to Gazi and he will give you the number which you omitted in this case '1'. In case the omitted number is '0' or '9' he says "0 or 9". Gazi don't want to do the calculations again and again so he request you to craft a code to do the same task.

Input The first line contains number of testcases 't' (1<=t<=100), second line contains the final number 'F' (10<=F<10^200) with a symbol of underscore where you omitted the number.

Output For each test case, print the omitted number and in case the number comes out to be '0' or '9' print "0 or 9". With a new line at the end of each output.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?