{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e由于参加了太多的Codeforces回合,吉东决定在一个公园里休息一下。他在一张长椅上坐下,很快他发现两只兔子在跳来跳去。其中一只兔子比另一只高。\u003c/p\u003e\n\u003cp\u003e他注意到,这两只兔子正向对方跳去。两只兔子的位置可以用水平线上的整数坐标来表示。较高的兔子目前在 $$$x$$$ 的位置,较矮的兔子目前在 $$$y$$$ 的位置($$$x \\lt y$$$)。每秒钟,每只兔子都跳到另一个位置。高的兔子以 $$$a$$$ 跳到正方向,矮的兔子以 $$$b$$$ 跳到负方向。\u003c/p\u003e\n\u003ccenter\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/6654bad54f26418cc0a959ee297cf6a4?v\u003d1666069624\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\n\u003c/center\u003e\n\u003cp\u003e例如,我们假设 $$$x\u003d0$$$,$$$y\u003d10$$$,$$$a\u003d2$$$,$$$b\u003d3$$$。在第1秒,每只兔子将在 $$$2$$$ 和 $$$7$$$ 的位置。在第2秒时,两只兔子都在 $$$4$$$ 的位置。\u003c/p\u003e\n\u003cp\u003e吉东现在在想: \u003cspan class\u003d\"tex-font-style-it\"\u003e两只兔子是否会\u003cspan class\u003d\"tex-font-style-bf\"\u003e在同一时刻\u003c/span\u003e 出现在同一位置?如果是这样,需要多长时间?\u003c/span\u003e 让我们找到一个时间点(以秒为单位),之后兔子会在同一个点上。\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e每个测试包含一个或多个测试用例。第一行包含测试用例的数量 $$$t$$$ ($$$1 \\le t \\le 1000$$$).\u003c/p\u003e\n\u003cp\u003e每个测试案例正好包含一行。该行由四个整数组成 $$$x$$$, $$$y$$$, $$$a$$$, $$$b$$$ ($$$0 \\le x \\lt y \\le 10^9$$$, $$$1 \\le a,b \\le 10^9$$$) — 分别为高个子兔子的当前位置,矮个子兔子的当前位置,高个子兔子的跳跃距离,以及矮个子兔子的跳跃距离。\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试案例,打印单个整数:两只兔子在同一位置所需的秒数。\u003c/p\u003e\n\u003cp\u003e如果两只兔子永远不会同时出现在同一位置,则打印 $$$-1$$$.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e5\n0 10 2 3\n0 10 3 3\n900000000 1000000000 1 9999999\n1 2 1 1\n1 3 1 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n-1\n10\n-1\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003e第一种情况在描述中进行了解释。\u003c/p\u003e\n\u003cp\u003e在第二种情况下,每只兔子在第 1 秒时将分别处于 $$$3$$$ 和 $$$7$$$ 的位置。但在第 2 秒时,它们将分别处于 $$$6$$$ 和 $$$4$$$ 的位置,我们可以看到,它们将永远不会处于相同的位置,因为两只兔子之间的距离以后只会增加。\u003c/p\u003e"}}]}