id number : 1 3 9 0 2 7 2 factors : 9 7 3 9 7 3 9 products : 9 21 27 0 14 21 18Here the checksum is 9+21+27+0+14+21+18 = 110. The last digit is zero, so the id is valid. Sometimes students have very bad handwriting and the teaching assistents have a hard time identifying the id’s. You're asked to help in special cases, where exactly one digit is unreadable. In that case, the missing digit can be computed (there's always exactly one correct digit, thanks to 9, 3 and 7 being relatively prime to 10). Note that the students always begin concentrated and thus the first digit will always be readable (and not zero).

The first line contains the number of scenarios. Each scenario is a single line that contains an id number with one digit replaced by a question mark and with six or seven digits length.

提交代码