\textit{This is an interactive problem.}

We define the Collatz function $\mathrm{collatz}(x)$ which operates on integers as follows: if $x$ is even, then $\mathrm{collatz}(x) = \frac{x}{2}$, and otherwise $\mathrm{collatz}(x) = 3x + 1$. The famous Collatz hypothesis states that if you start with any positive integer $x_0$ and construct a sequence $x_1 = \mathrm{collatz}(x_0)$, \ldots, $x_{i + 1} = \mathrm{collatz}(x_i)$, then the sequence will eventually reach the number one.

The incredible complexity that has kept the hypothesis neither proven nor disproven lies in the very chaotic behavior of the sequence $\left\{x_i\right\}$ until it reaches one. Even for very small numbers, one can reach the number one quite late: for example, starting with $x_0 = 9$, we get $$9 \to 28 \to 14 \to 7 \to 22 \to 11 \to 34 \to 17 \to 52 \to 26 \to 13 \to 40 \to 20 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1\text{,}$$ and if we start with $x_0 = 27$, we only reach one after 111 applications of $\mathrm{collatz}(x)$!

You are sitting in front of a machine that has a screen and two buttons: red and blue. The screen displays a positive integer (it is guaranteed to be a random integer from $2$ to $10^7$, inclusive), and you need to turn it into one. The red button is called \texttt{collatz}, and it replaces the number $x$ on the screen with $\mathrm{collatz}(x)$. The blue button is called \texttt{random}, and it replaces $x$ with a random integer from $3x + 1$ to $6x$, inclusive. Pressing the buttons is not free: after each button press, when the screen displays the number $x_{i + 1}$, you need to insert as many tokens into the machine as there are digits in the decimal representation of the number $x_{i + 1}$. For example, in the above process starting from nine, you need to pay for all the digits of the numbers $28, 14, 7, \ldots, 2, 1$; this will cost you 32 tokens.

If you only press the red button, you will reach one, spending an average of 707 tokens. Although the blue button always increases the number on the screen (and significantly), you can speed up the process of reaching one by pressing the blue button at the right moments! Your task is to write a program that spends on average no more than 600 tokens for a single number. To reduce the randomness in the checks, we will provide the program with $t \le 50$ random starting numbers in each test, and you need to turn all of them into ones for a total of $600 \cdot 50 = 30\,000$ tokens.