{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ch1 id\u003d\"right-turn\"\u003eRight turn\u003c/h1\u003e\n\u003cp\u003efrog is trapped in a maze. The maze is infinitely large and divided into grids. It also consists of \u003cspan class\u003d\"math\"\u003e\\(n\\)\u003c/span\u003e obstacles, where the \u003cspan class\u003d\"math\"\u003e\\(i\\)\u003c/span\u003e-th obstacle lies in grid \u003cspan class\u003d\"math\"\u003e\\((x_i, y_i)\\)\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003efrog is initially in grid \u003cspan class\u003d\"math\"\u003e\\((0, 0)\\)\u003c/span\u003e, heading grid \u003cspan class\u003d\"math\"\u003e\\((1, 0)\\)\u003c/span\u003e. She moves according to \u003cem\u003eThe Law of Right Turn\u003c/em\u003e: she keeps moving forward, and turns right encountering a obstacle.\u003c/p\u003e\n\u003cp\u003eThe maze is so large that frog has no chance to escape. Help her find out the number of turns she will make.\u003c/p\u003e\n\u003ch2 id\u003d\"input\"\u003eInput\u003c/h2\u003e\n\u003cp\u003eThe input consists of multiple tests. For each test:\u003c/p\u003e\n\u003cp\u003eThe first line contains \u003cspan class\u003d\"math\"\u003e\\(1\\)\u003c/span\u003e integer \u003cspan class\u003d\"math\"\u003e\\(n\\)\u003c/span\u003e (\u003cspan class\u003d\"math\"\u003e\\(0 \\leq n \\leq 10^3\\)\u003c/span\u003e). Each of the following \u003cspan class\u003d\"math\"\u003e\\(n\\)\u003c/span\u003e lines contains \u003cspan class\u003d\"math\"\u003e\\(2\\)\u003c/span\u003e integers \u003cspan class\u003d\"math\"\u003e\\(x_i, y_i\\)\u003c/span\u003e. (\u003cspan class\u003d\"math\"\u003e\\(|x_i|, |y_i| \\leq 10^9, (x_i, y_i) \\neq (0, 0)\\)\u003c/span\u003e, all \u003cspan class\u003d\"math\"\u003e\\((x_i, y_i)\\)\u003c/span\u003e are distinct)\u003c/p\u003e\n\u003ch2 id\u003d\"output\"\u003eOutput\u003c/h2\u003e\n\u003cp\u003eFor each test, write \u003cspan class\u003d\"math\"\u003e\\(1\\)\u003c/span\u003e integer which denotes the number of turns, or ``\u003ccode\u003e-1\u003c/code\u003e\u0027\u0027 if she makes infinite turns.\u003c/p\u003e\n\u003ch2 id\u003d\"sample-input\"\u003eSample Input\u003c/h2\u003e\n\u003cpre\u003e\u003ccode\u003e 2\n 1 0\n 0 -1\n 1\n 0 1\n 4\n 1 0\n 0 1\n 0 -1\n -1 0\u003c/code\u003e\u003c/pre\u003e\n\u003ch2 id\u003d\"sample-output\"\u003eSample Output\u003c/h2\u003e\n\u003cpre\u003e\u003ccode\u003e 2\n 0\n -1\u003c/code\u003e\u003c/pre\u003e"}}]}