{"raw_statement":[{"iden":"problem statement","content":"Given is a positive integer $N$. Consider a sequence of integers $A = (A_1, \\ldots, A_K)$ that satisfies the conditions below:\n\n*   $\\sum_{i=1}^K A_i = N$;\n*   each $A_i$ is a positive integer such that every digit in its decimal notation is $1$, $2$, or $3$.\n\nFind the minimum possible value of $K$, that is, the number of elements in such a sequence $A$.\nProcess $T$ test cases per input file."},{"iden":"constraints","content":"*   $1\\leq T\\leq 1000$\n*   $1\\leq N\\leq 10^{18}$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$T$\n$\\text{case}_1$\n$\\text{case}_2$\n$\\vdots$\n$\\text{case}_T$\n\nEach case is in the following format:\n\n$N$"},{"iden":"sample input 1","content":"5\n456\n10000\n123\n314\n91"},{"iden":"sample output 1","content":"2\n4\n1\n2\n4\n\nFor each $N$, one optimal $A$ is shown below.\n\n*   For $N = 456$: $A = (133, 323)$.\n*   For $N = 10000$: $A = (323, 3132, 3232, 3313)$.\n*   For $N = 123$: $A = (123)$.\n*   For $N = 314$: $A = (312,2)$.\n*   For $N = 91$: $A = (22,23,23,23)$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}