{"raw_statement":[{"iden":"problem statement","content":"Solve the following problem for $T$ test cases.\nGiven an integer $N$, find the number of integers $x$ that satisfy all of the following conditions:\n\n*   $1 \\le x \\le N$\n*   Let $y = \\lfloor \\sqrt{x} \\rfloor$. When $x$ and $y$ are written in decimal notation (without leading zeros), $y$ is a prefix of $x$."},{"iden":"constraints","content":"*   $T$ is an integer such that $1 \\le T \\le 10^5$.\n*   $N$ is an integer such that $1 \\le N \\le 10^{18}$."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$T$\n$N_1$\n$N_2$\n$\\vdots$\n$N_T$\n\nHere, $N_i$ represents the integer $N$ for the $i$\\-th test case."},{"iden":"sample input 1","content":"2\n1\n174"},{"iden":"sample output 1","content":"1\n22\n\nThis input contains two test cases.\n\n*   For the first test case, $x=1$ satisfies the conditions since $y = \\lfloor \\sqrt{1} \\rfloor = 1$.\n*   For the second test case, for example, $x=100$ satisfies the conditions since $y = \\lfloor \\sqrt{100} \\rfloor = 10$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}