{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\n\tThere is an interesting and simple one person game. Suppose there is a number axis under your feet.\n\tYou are at point \u003ci\u003eA\u003c/i\u003e at first and your aim is point \u003ci\u003eB\u003c/i\u003e. There are 6 kinds of operations you can \n\tperform in one step. That is to go left or right by \u003ci\u003ea\u003c/i\u003e,\u003ci\u003eb\u003c/i\u003e and \u003ci\u003ec\u003c/i\u003e, here \u003ci\u003ec\u003c/i\u003e always equals to \u003ci\u003ea\u003c/i\u003e+\u003ci\u003eb\u003c/i\u003e.\n\n\t\n\u003c/p\u003e\n\n\u003cp\u003e\n \t\tYou must arrive B as soon as possible. Please calculate the minimum number of steps.\n \t\n\n\n\u003c/p\u003e\u003cp\u003e\n\n\u003c/p\u003e\u003ch4\u003eInput\u003c/h4\u003e\n\u003cp\u003e\nThere are multiple test cases. The first line of input is an integer \u003ci\u003eT\u003c/i\u003e(0 \u0026lt; \u003ci\u003eT\u003c/i\u003e ≤ 1000) indicates the number of test cases.\n Then \u003ci\u003eT\u003c/i\u003e test cases follow.\n Each test case is represented by a line containing four integers 4 integers \u003ci\u003eA\u003c/i\u003e, \u003ci\u003eB\u003c/i\u003e, \u003ci\u003ea\u003c/i\u003e and \u003ci\u003eb\u003c/i\u003e, separated by spaces. (-2\u003csup\u003e31\u003c/sup\u003e ≤ \u003ci\u003eA\u003c/i\u003e, \u003ci\u003eB\u003c/i\u003e \u0026lt; 2\u003csup\u003e31\u003c/sup\u003e, 0 \u0026lt; \u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e \u0026lt; 2\u003csup\u003e31\u003c/sup\u003e)\n \n \u003c/p\u003e\n\n\u003ch4\u003eOutput\u003c/h4\u003e\n\u003cp\u003e\n\tFor each test case, output the minimum number of steps. If it\u0027s impossible to reach point \u003ci\u003eB\u003c/i\u003e, output \"-1\" instead.\n\u003c/p\u003e \n\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n0 1 1 2\n0 1 2 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n-1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003e\n\n\t\n\u003c/p\u003e"}}]}