AFei loves numbers. He defines the natural number containing "520" as the AFei number, such as $1234520, 8752012$ and $5201314$. Now he wants to know how many AFei numbers are not greater than $n$.
The first line contains an integer $T (1 ≤ T ≤ 100 )$.
The following $T$ lines contain an interger $n ( 0 ≤ n ≤ 1e^{18} )$.
For the last $T$ lines, output the total numbers of AFei numbers that are not greater than $n$.
For the first case, only $520$ is AFei number.
For the second case, $520,1520, 2520, 3520, 4520, 5200, 5201, 5202, 5203, 5204, 5205, 5206,
5207, 5208, 5209 and 5520$ are AFei number. So there are $16$ AFei numbers.