Solve the programming task below in a Python markdown code block.
Charlie and Johnny play a game. For every integer $\mbox{X}$ Charlie gives, Johnny has to find the smallest positive integer $\mathbf{Y}$ such that $X\times Y$ ($\mbox{X}$ multiplied by $\mathbf{Y}$) contains only 4s and 0s and starts with one or more 4s followed by zero or more 0s. For example, 404 is an invalid number but 4400, 440, and 444 are valid numbers. 

If $\boldsymbol{a}$ is the number of 4s and $\boldsymbol{b}$ is the number of 0s, can you print the value of $(2\times a)+b$?  

Input Format  

The first line of input contains a single integer $\mathbf{T}$, the number of test cases.  

$\mathbf{T}$ lines follow, each line containing the integer $\mbox{X}$ as stated above.

Output Format  

For every $\mbox{X}$, print the output $(2\times a)+b$ in a newline as stated in the problem statement.  

Constraints  

$1\leq T\leq100$ 

$1\leq X\leq10^{10}$  

Sample Input  

3
4
5
80

Sample Output  

2
3
4

Explanation  

For the 1^{st} test case, the smallest such multiple of $4}$ is 4 itself. Hence the value of $\boldsymbol{a}$ will be $\mbox{1}$ and and the value of $\boldsymbol{b}$ will be $\mbox{0}$, and the answer is $(2\times a)+b=2$.  

For the 2^{nd} test case, $Y=8$ and 40 is the minimum such multiple of $5$. Hence the values of $\boldsymbol{a}$, $\boldsymbol{b}$ and $(2\times a)+b$ will be $\mbox{1}$, $\mbox{1}$ and $3$ respectively.