Someone left a physical mirror inside the holodeck chamber and it scrambled part of the simulation data. The mirror laid the reversed data on top of the original data. You have to work out how badly the data is scrambled.
Given a positive integer Y, count the distinct positive integers X with Y=X+rev(X). The rev operator reverses the digits of a number. Each X must be written in ordinary decimal form, with no leading zeros. For example, rev(350)=53 and rev(53)=35.
The first line has one integer T (1≤T≤500), the number of test cases. Each test case is a single line with one integer Y (1≤Y<1018).
For each test case, print one line with the count of positive integers whose sum with their own reverse equals Y.