{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\u003cb\u003eProblem Description\u003c/b\u003e\u003c/p\u003e \n\u003cp\u003eRaven likes games of numbers. Today he meets two numbers and thinks whether he could get a result of 1 by doing at least one operation (addition or subtraction). However, he is tired of calculation; he also wants to know the minimum steps of operation that he could get 1. \u003c/p\u003e \n\u003cp\u003e\u003cb\u003eInput Details\u003c/b\u003e\u003c/p\u003e \n\u003cp\u003eThe first line of the input contains an integer T, which indicates the number of test cases.\u003c/p\u003e \n\u003cp\u003eIn the following T rows, there are two positive integers a, b ( 0\u0026lt;\u003da, b\u0026lt;\u003d10^9) in each row.\u003c/p\u003e \n\u003cp\u003e\u003cb\u003eOutput Details\u003c/b\u003e\u003c/p\u003e \n\u003cp\u003eFor each case, output the least number of steps.\u003c/p\u003e \n\u003cp\u003eIf you cannot get 1, just output -1.\u003c/p\u003e \n\u003cp\u003e\u003cb\u003eSample Input\u003c/b\u003e\u003c/p\u003e \n\u003cp\u003e\u003c/p\u003e\n\u003cpre\u003e3\n3 2\n16 9\n6 8\n\u003c/pre\u003e\n\u003cp\u003e\u003c/p\u003e \n\u003cp\u003e\u003cb\u003eSample Output\u003c/b\u003e\u003c/p\u003e \n\u003cp\u003e\u003c/p\u003e\n\u003cpre\u003e1\n10\n-1\n\u003c/pre\u003e\n\u003cp\u003e\u003c/p\u003e \n\u003cp\u003e\u003cb\u003eHint\u003c/b\u003e\u003c/p\u003e \n\u003cp\u003e\u003c/p\u003e\n\u003cpre\u003eSample 1: 3 - 2 \u003d 1, One subtraction will be needed.\nSample 2: 16-9+16-9+16-9-9-9+16-9-9\u003d1,It requires 10 additions and subtractions.\nSample 3: You cannot get 1.\u003c/pre\u003e\n\u003cp\u003e\u003c/p\u003e"}}]}