{"raw_statement":[{"iden":"problem statement","content":"You are given pairs of non-negative integers $a = (a_1,a_2)$ and $b = (b_1,b_2)$. You can perform the following operation on the pair $a$ any number of times, possibly zero.\n\n*   Operation: Choose a **positive real number** $x$. Replace $a = (a_1,a_2)$ with $(\\lfloor a_1x\\rfloor, \\lfloor a_2x\\rfloor)$.\n\nYour objective is to make the pair $a$ equal the pair $b$. Determine whether it is achievable. If it is, find the minimum number of times you must perform the operation to achieve it.\nYou have $T$ test cases to solve."},{"iden":"constraints","content":"*   $1\\leq T\\leq 10^5$\n*   $0\\leq a_1, a_2, b_1, b_2 \\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 given in the following format:\n\n$a_1$ $a_2$ $b_1$ $b_2$"},{"iden":"sample input 1","content":"7\n2 3 1 1\n1 1 2 3\n3 2 9 8\n12 34 56 78\n56 78 12 34\n87 65 43 21\n43 21 87 65"},{"iden":"sample output 1","content":"1\n-1\n3\n-1\n4\n2\n-1\n\nFor the first test case, here is one optimal solution.\n\n*   Initially, $a = (2,3)$.\n*   Perform the operation with $x = 0.6$, replacing $a$ with $(\\lfloor 1.2 \\rfloor, \\lfloor 1.8\\rfloor) = (1,1)$.\n\nFor the third test case, here is one optimal solution.\n\n*   Initially, $a = (3,2)$.\n*   Perform the operation with $x = 1.5$, replacing $a$ with $(4,3)$.\n*   Perform the operation with $x = 1.7$, replacing $a$ with $(6,5)$.\n*   Perform the operation with $x = 1.6$, replacing $a$ with $(9,8)$."},{"iden":"sample input 2","content":"9\n5 5 5 5\n5 5 3 3\n3 9 0 2\n3 9 0 3\n0 3 3 9\n3 0 2 0\n5 2 0 0\n0 0 5 2\n0 0 0 0"},{"iden":"sample output 2","content":"0\n1\n1\n2\n-1\n1\n1\n-1\n0"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}