{"raw_statement":[{"iden":"problem statement","content":"You are given integers $x_1$, $x_2$, and $x_3$. For these integers, you can perform the following operation any number of times, possibly zero.\n\n*   Choose a permutation $(i,j,k)$ of $(1,2,3)$, that is, a triple of integers $(i,j,k)$ such that $1\\leq i,j,k\\leq 3$ and $i\\neq j, i\\neq k, j\\neq k$.\n*   Then, simultaneously replace $x_i$ with $x_i+3$, $x_j$ with $x_j+5$, and $x_k$ with $x_k+7$.\n\nYour objective is to satisfy $x_1=x_2=x_3$. Determine whether it is achievable. If it is, print the minimum number of times you need to perform the operation to achieve it.\nYou have $T$ test cases to solve."},{"iden":"constraints","content":"*   $1\\leq T\\leq 2\\times 10^5$\n*   $1\\leq x_1, x_2, x_3 \\leq 10^9$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$T$\n$\\text{case}_1$\n$\\vdots$\n$\\text{case}_T$\n\nEach test case is in the following format:\n\n$x_1$ $x_2$ $x_3$"},{"iden":"sample input 1","content":"4\n2 8 8\n1 1 1\n5 5 10\n10 100 1000"},{"iden":"sample output 1","content":"2\n0\n-1\n315\n\nFor the first test case, you can do the following to satisfy $x_1=x_2=x_3$.\n\n*   Perform the operation with $(i,j,k) = (3,2,1)$, replacing $(x_1,x_2,x_3)$ with $(9,13,11)$.\n*   Perform the operation with $(i,j,k) = (2,3,1)$, replacing $(x_1,x_2,x_3)$ with $(16,16,16)$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}