Hide

Problem I
Gene Block

/problems/geneblock/file/statement/en/img-0001.png
Block Trade

You discovered that you could easily trade a big dirt block of size $N$ for one of the rarest Minecraft blocks, Gene. Although excessively abundant, dirt blocks in this server come in different sizes — and, after careful observation, you realized that the size of each individual dirt block is always a positive integer that ends with $7$, i.e. $7$, $17$, $27$, etc. What is the minimum number of dirt blocks you need to trade for the Gene block?

Input

The first line contains an integer $1 \leq t \leq 405$, giving the number of test cases to follow. Each case consists of one line containing a single integer $0 < N \leq 10^9 $, the size of the dirt block you need to make in order to trade for the Gene block.

Output

For each test case, output one line containing a single number, the minimum number of dirt blocks you need to trade for the Gene block, or $-1$ if it cannot be done.

Sample Input 1 Sample Output 1
3
84
85
106054
2
5
2

Please log in to submit a solution to this problem

Log in