{"problem":{"name":"Engines","description":{"content":"E869120 is initially standing at the origin $(0, 0)$ in a two-dimensional plane. He has $N$ engines, which can be used as follows: *   When E869120 uses the $i$\\-th engine, his $X$\\- and $Y$\\-coordin","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc139_f"},"statements":[{"statement_type":"Markdown","content":"E869120 is initially standing at the origin $(0, 0)$ in a two-dimensional plane.\nHe has $N$ engines, which can be used as follows:\n\n*   When E869120 uses the $i$\\-th engine, his $X$\\- and $Y$\\-coordinate change by $x_i$ and $y_i$, respectively. In other words, if E869120 uses the $i$\\-th engine from coordinates $(X, Y)$, he will move to the coordinates $(X + x_i, Y + y_i)$.\n*   E869120 can use these engines in any order, but each engine can be used at most once. He may also choose not to use some of the engines.\n\nHe wants to go as far as possible from the origin. Let $(X, Y)$ be his final coordinates. Find the maximum possible value of $\\sqrt{X^2 + Y^2}$, the distance from the origin.\n\n## Constraints\n\n*   $1 \\leq N \\leq 100$\n*   $-1 \\ 000 \\ 000 \\leq x_i \\leq 1 \\ 000 \\ 000$\n*   $-1 \\ 000 \\ 000 \\leq y_i \\leq 1 \\ 000 \\ 000$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$x_1$ $y_1$\n$x_2$ $y_2$\n $:$ $:$\n$x_N$ $y_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc139_f","tags":[],"sample_group":[["3\n0 10\n5 -5\n-5 -5","10.000000000000000000000000000000000000000000000000\n\nThe final distance from the origin can be $10$ if we use the engines in one of the following three ways:\n\n*   Use Engine $1$ to move to $(0, 10)$.\n*   Use Engine $2$ to move to $(5, -5)$, and then use Engine $3$ to move to $(0, -10)$.\n*   Use Engine $3$ to move to $(-5, -5)$, and then use Engine $2$ to move to $(0, -10)$.\n\nThe distance cannot be greater than $10$, so the maximum possible distance is $10$."],["5\n1 1\n1 0\n0 1\n-1 0\n0 -1","2.828427124746190097603377448419396157139343750753\n\nThe maximum possible final distance is $2 \\sqrt{2} = 2.82842...$. One of the ways to achieve it is:\n\n*   Use Engine $1$ to move to $(1, 1)$, and then use Engine $2$ to move to $(2, 1)$, and finally use Engine $3$ to move to $(2, 2)$."],["5\n1 1\n2 2\n3 3\n4 4\n5 5","21.213203435596425732025330863145471178545078130654\n\nIf we use all the engines in the order $1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 \\rightarrow 5$, we will end up at $(15, 15)$, with the distance $15 \\sqrt{2} = 21.2132...$ from the origin."],["3\n0 0\n0 1\n1 0","1.414213562373095048801688724209698078569671875376\n\nThere can be useless engines with $(x_i, y_i) = (0, 0)$."],["1\n90447 91000","128303.000000000000000000000000000000000000000000000000\n\nNote that there can be only one engine."],["2\n96000 -72000\n-72000 54000","120000.000000000000000000000000000000000000000000000000\n\nThere can be only two engines, too."],["10\n1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 18\n19 20","148.660687473185055226120082139313966514489855137208"]],"created_at":"2026-03-03 11:01:13"}}