AtCoder Beginner Contest 139 - Engines

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-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).
 - 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.
He 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.

-----Constraints-----
 - 1 \leq N \leq 100
 - -1 \ 000 \ 000 \leq x_i \leq 1 \ 000 \ 000
 - -1 \ 000 \ 000 \leq y_i \leq 1 \ 000 \ 000
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
x_1 y_1
x_2 y_2
 : :
x_N y_N

-----Output-----
Print the maximum possible final distance from the origin, as a real value.
Your output is considered correct when the relative or absolute error from the true answer is at most 10^{-10}.

-----Sample Input-----
3
0 10
5 -5
-5 -5

-----Sample Output-----
10.000000000000000000000000000000000000000000000000

The final distance from the origin can be 10 if we use the engines in one of the following three ways:
 - Use Engine 1 to move to (0, 10).
 - Use Engine 2 to move to (5, -5), and then use Engine 3 to move to (0, -10).
 - Use Engine 3 to move to (-5, -5), and then use Engine 2 to move to (0, -10).
The distance cannot be greater than 10, so the maximum possible distance is 10.

Source: atcoder | Difficulty: MEDIUM_HARD


Solutions:
import math
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
l.sort(key=lambda x: math.atan2(x[1], x[0]))
l += l
ans = 0
for i in range(n):
	x = y = 0
	for j in range(n):
		(nx, ny) = l[i + j]
		x += nx
		y += ny
		ans = max(ans, (x ** 2 + y ** 2) ** 0.5)
print(ans)


from math import atan2
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key=lambda x: atan2(x[1], x[0]))
ans = 0
for lp in range(n):
	for rg in range(n):
		lf = lp
		(x, y) = l[lf]
		lf += 1
		if lf == n:
			lf = 0
		while lf != rg:
			x += l[lf][0]
			y += l[lf][1]
			lf += 1
			if lf == n:
				lf = 0
		ans = max(ans, (x ** 2 + y ** 2) ** 0.5)
print(ans)


from math import atan2, hypot

def solve():
	N = int(input())
	engines = [tuple(map(int, input().split())) for _ in range(N)]
	engines.sort(key=lambda x: atan2(x[1], x[0]))
	ans = 0
	for L in range(N):
		for R in range(L, L + N):
			(x, y) = (0, 0)
			for i in range(L, R + 1):
				i %= N
				(dx, dy) = engines[i]
				(x, y) = (x + dx, y + dy)
			dist = hypot(x, y)
			if dist > ans:
				ans = dist
	print(ans)
solve()


from math import atan2, sqrt

def main():
	n = int(input())
	engines = [list(map(int, input().split())) for _ in range(n)]
	for i in range(n):
		rad = atan2(engines[i][1], engines[i][0])
		engines[i].append(rad)
	engines.sort(key=lambda x: x[2])
	ans = 0
	for k in range(1, n + 1):
		for i in range(n):
			(x_sum, y_sum) = (0, 0)
			for j in range(i, i + k):
				p = j % n
				x_sum += engines[p][0]
				y_sum += engines[p][1]
			tmp = x_sum ** 2 + y_sum ** 2
			if ans < tmp:
				ans = tmp
	print(sqrt(ans))
main()


import math
import numpy as np
n = int(input())
eng_list = []
for _ in range(n):
	a = np.array(list(map(int, input().split())))
	eng_list.append(a)
angles = []
for i in range(n):
	cos = np.dot(eng_list[i], np.array([0, 1])) / np.linalg.norm(eng_list[i])
	angle = math.degrees(math.acos(cos))
	if eng_list[i][0] < 0:
		angle = 360 - angle
	angles.append(angle)

def hantei(a, b):
	coss = np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
	if coss > 1:
		coss = 1.0
	elif coss < -1:
		coss = -1.0
	angg = math.degrees(math.acos(coss))
	if angg < 90.0001:
		return True
	else:
		return False

def distance(a):
	dis = np.linalg.norm(a)
	return dis
pitch = 1
dist = []
for ikisaki in np.arange(0, 360, pitch):
	dist_location = np.array([0, 0])
	for j in eng_list:
		i = np.array([math.cos(math.radians(ikisaki)), math.sin(math.radians(ikisaki))])
		if hantei(i, j):
			dist_location = dist_location + j
	dist.append(distance(dist_location))
print(max(dist))


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
import numpy as np
e = (1, 0)
xyz = []
k = 0
for (x, y) in xy:
	if x == 0 and y == 0:
		continue
	k += 1
	l = np.linalg.norm((x, y))
	z = np.inner((x / l, y / l), e)
	theta = np.rad2deg(np.arccos(z))
	if y < 0:
		theta = 360 - theta
	xyz.append((x, y, theta))
xyz.sort(key=lambda x: x[2])
(tx, ty) = (0, 0)
c = [(0, 0)]
for (x, y, z) in xyz:
	tx += x
	ty += y
	c.append((tx, ty))
for (x, y, z) in xyz:
	tx += x
	ty += y
	c.append((tx, ty))
ans = 0
for i in range(k):
	for j in range(k):
		x = c[i + j + 1][0] - c[i][0]
		y = c[i + j + 1][1] - c[i][1]
		ans = max(ans, (x ** 2 + y ** 2) ** 0.5)
print(ans)


import sys, math
input = sys.stdin.readline
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(500):
	x = math.cos(2 * math.pi * i / 500)
	y = math.sin(2 * math.pi * i / 500)
	ax = 0
	ay = 0
	for (dx, dy) in xy:
		if x * dx + y * dy >= 0:
			ax += dx
			ay += dy
	ans = max(ans, (ax ** 2 + ay ** 2) ** 0.5)
print(ans)


def det(p, q):
	return p[0] * q[1] - p[1] * q[0]

def sub(p, q):
	return (p[0] - q[0], p[1] - q[1])

def get_convex_hull(points):
	n = len(points)
	points.sort()
	size_convex_hull = 0
	ch = []
	for i in range(n):
		while size_convex_hull > 1:
			v_cur = sub(ch[-1], ch[-2])
			v_new = sub(points[i], ch[-2])
			if det(v_cur, v_new) > 0:
				break
			size_convex_hull -= 1
			ch.pop()
		ch.append(points[i])
		size_convex_hull += 1
	t = size_convex_hull
	for i in range(n - 2, -1, -1):
		while size_convex_hull > t:
			v_cur = sub(ch[-1], ch[-2])
			v_new = sub(points[i], ch[-2])
			if det(v_cur, v_new) > 0:
				break
			size_convex_hull -= 1
			ch.pop()
		ch.append(points[i])
		size_convex_hull += 1
	return ch[:-1]
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
ps = [(0, 0)]
for (x, y) in XY:
	ps_new = ps[:]
	for (x_, y_) in ps:
		ps_new.append((x + x_, y + y_))
	ps = get_convex_hull(ps_new)
ans = 0
for (x, y) in ps:
	ans = max(ans, x * x + y * y)
print(ans ** 0.5)


1
import math
N = int(input())
P = []
for _ in range(N):
	P.append([int(n) for n in input().split()])
R2 = 0
for i in range(360):
	theta = 2 * math.pi * i / 360
	(a, b) = (math.cos(theta), math.sin(theta))
	(X, Y) = (0, 0)
	for (x, y) in P:
		if a * x + b * y > 0:
			X += x
			Y += y
	r2 = X ** 2 + Y ** 2
	if r2 > R2:
		R2 = r2
print(math.sqrt(R2))


import math
n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
args = sorted([(math.atan2(y, x), x, y) for (x, y) in xy])
ans = 0
for (key, (sarg, sx, sy)) in enumerate(args):
	(tmpx, tmpy) = (sx, sy)
	dist = tmpx ** 2 + tmpy ** 2
	for (arg, x, y) in args[key + 1:]:
		tmpx += x
		tmpy += y
		tmp = tmpx ** 2 + tmpy ** 2
		if tmp < dist:
			break
		else:
			dist = tmp
	for (arg, x, y) in args[:key]:
		tmpx += x
		tmpy += y
		tmp = tmpx ** 2 + tmpy ** 2
		if tmp < dist:
			break
		else:
			dist = tmp
	ans = max(ans, dist)
print(math.sqrt(ans))


import sys
from math import sqrt
input = sys.stdin.readline
N = int(input())
e = []
for _ in range(N):
	(x, y) = map(int, input().split())
	e.append((x, y))
res = 0
for i in range(N):
	for j in range(N):
		u = e[i][0] + e[j][0]
		v = e[i][1] + e[j][1]
		px = 0
		py = 0
		for k in range(N):
			(x, y) = e[k]
			if u * x + v * y > 0:
				px += x
				py += y
		res = max(res, sqrt(px ** 2 + py ** 2))
print(res)


import sys
import math
n = int(sys.stdin.readline().rstrip())
point = []
for i in range(n):
	ax = list(map(int, sys.stdin.readline().rstrip().split()))
	if ax[0] != 0 or ax[1] != 0:
		point.append(ax)
result = 0
plen = len(point)
if plen == 0:
	print(0)
	exit()
point = sorted(point, key=lambda x: math.atan2(x[1], x[0]))
point = point + point
for i in range(plen):
	maxdig = 0
	maxp = [0, 0]
	for j in range(i, i + plen):
		tmpp = (maxp[0] + point[j][0]) ** 2 + (maxp[1] + point[j][1]) ** 2
		if maxdig > tmpp:
			if result < maxdig:
				result = maxdig
			break
		else:
			maxdig = tmpp
			maxp[0] += point[j][0]
			maxp[1] += point[j][1]
			if j == i + plen - 1 and result < maxdig:
				result = maxdig
print(result ** 0.5)


import numpy as np
n = int(input())
xy = []
for i in range(n):
	xy.append(list(map(int, input().split())))

def naiseki(a, b):
	if a[0] * b[0] + a[1] * b[1] > 0.0:
		return True
	else:
		return False
ans = 0
for i in range(1001):
	xl = np.cos(np.pi * 2.0 * i / 1000.0)
	yl = np.sin(np.pi * 2.0 * i / 1000.0)
	x = 0
	y = 0
	for j in range(n):
		if naiseki([xl, yl], xy[j]):
			x += xy[j][0]
			y += xy[j][1]
	ans = max(ans, np.sqrt(x ** 2 + y ** 2))
print(ans)


import numpy as np
n = int(input())
(x, y) = np.array([list(map(int, input().split())) for _ in range(n)]).T

def isin90deg(v1, v2):
	if np.dot(v1, v2) >= 0:
		return 1
	else:
		return 0

def is90deg(v1, v2):
	if np.dot(v1, v2) == 0:
		return 1
	else:
		return 0
ans = []
for i in range(n):
	(tv, nv1) = (np.array([x[i], y[i]]), np.array([y[i], -x[i]]))
	nv2 = -nv1
	for nv in [nv1, nv2]:
		(sum, posi, nega) = (np.array([0, 0]), np.array([0, 0]), np.array([0, 0]))
		for j in range(n):
			v = np.array([x[j], y[j]])
			if isin90deg(v, nv):
				sum += v
			if is90deg(v, nv) and isin90deg(v, tv):
				posi += v
			if is90deg(v, nv) and (not isin90deg(v, tv)):
				nega += v
		ans.append(np.linalg.norm(sum, ord=2))
		ans.append(np.linalg.norm(sum - posi, ord=2))
		ans.append(np.linalg.norm(sum - nega, ord=2))
print(max(ans))


def solve():
	from math import atan2, pi, hypot
	n = int(input())
	txy = []
	(sx, sy) = (0, 0)
	for i in range(n):
		(a, b) = map(int, input().split())
		theta_0 = atan2(b, a)
		sx += a
		sy += b
		txy.append((theta_0, a, b))
	txy.sort()
	ans = hypot(sx, sy)
	for i in range(n):
		for j in range(i + 1, n):
			(tx, ty) = (0, 0)
			for k in range(i, j):
				(theta, x, y) = txy[k]
				tx += x
				ty += y
				ans = max(ans, hypot(tx, ty))
				ans = max(ans, hypot(sx - tx, sy - ty))
	print(ans)
solve()


import math
n = int(input())
XY = []
for _ in range(n):
	(x, y) = map(int, input().split())
	if x == y == 0:
		continue
	XY.append((x, y))
l = len(XY)
if l:
	XY.sort(key=lambda x: math.atan2(x[1], x[0]))
	ans = 0
	XY += XY
	for i in range(l):
		(x, y) = (0, 0)
		for j in range(i, i + l):
			x += XY[j][0]
			y += XY[j][1]
			ans = max(ans, x ** 2 + y ** 2)
	print(ans ** 0.5)
else:
	print(0)


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(N, XY):
	SXY = [(math.atan2(y, x), x, y) for (x, y) in XY]
	SXY.sort()
	ans = 0
	for i in range(N):
		cx = 0
		cy = 0
		for j in range(N):
			(_, x, y) = SXY[i - j]
			cx += x
			cy += y
			ans = max(ans, cx ** 2 + cy ** 2)
	return math.sqrt(ans)

def main():
	N = read_int()
	XY = [read_int_n() for _ in range(N)]
	print('%.100f' % slv(N, XY))
main()


import math
from itertools import accumulate
N = int(input())
X = []
Y = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
arr = []
for (x, y) in zip(X, Y):
	arr.append((math.atan2(y, x), x, y))
arr.sort()
accX = list(accumulate([a[1] for a in arr]))
accY = list(accumulate([a[2] for a in arr]))
ans = float('-inf')
for f in range(N):
	for t in range(N):
		if f <= t:
			tmpX = accX[t] - (accX[f - 1] if f > 0 else 0)
			tmpY = accY[t] - (accY[f - 1] if f > 0 else 0)
			tmp = tmpX ** 2 + tmpY ** 2
			ans = ans if ans > tmp else tmp
		else:
			tmpX = accX[N - 1] - (accX[f - 1] if f > 0 else 0) + accX[t]
			tmpY = accY[N - 1] - (accY[f - 1] if f > 0 else 0) + accY[t]
			tmp = tmpX ** 2 + tmpY ** 2
			ans = ans if ans > tmp else tmp
print(math.sqrt(ans))


import sys
from itertools import accumulate, combinations
from math import atan2
read = sys.stdin.read
(N, *xy) = map(int, read().split())
xy = sorted(zip(*[iter(xy)] * 2), key=lambda x: atan2(x[1], x[0]))
xy = [(0, 0)] + xy
xy *= 2
xy = list(zip(*map(list, map(accumulate, zip(*xy)))))
answer = 0
for n in range(N + 1):
	for (i, j) in combinations(range(n, n + N + 1), 2):
		(x1, y1) = xy[i]
		(x2, y2) = xy[j]
		candidate = (x1 - x2) ** 2 + (y1 - y2) ** 2
		if candidate > answer:
			answer = candidate
print(answer ** 0.5)


import math
N = int(input())
engines = tuple((complex(*map(int, input().split())) for _ in range(N)))
engines = sorted(list(((engine, math.atan2(engine.imag, engine.real)) for engine in engines if engine != 0)), key=lambda x: x[1])
N = len(engines)
if N == 0:
	print(0)
else:
	total = sum((engine[0] for engine in engines))
	head_index = max((i if engines[i][0].imag < 0 else -1 for i in range(N)))
	tail_index = 0
	tmp = sum((engines[i][0] for i in range(tail_index, head_index + 1)))
	maximum = max(abs(tmp), abs(total - tmp))
	while True:
		if head_index < N - 1:
			if (engines[head_index + 1][0] / engines[tail_index][0]).imag >= 0:
				head_index += 1
			else:
				tail_index += 1
		elif (engines[0][0] / engines[tail_index][0]).imag < 0:
			tail_index += 1
		else:
			break
		tmp = sum((engines[i][0] for i in range(tail_index, head_index + 1)))
		maximum = max(maximum, abs(tmp), abs(total - tmp))
	print(maximum)


from math import *

def main():
	n = int(input())
	ab = [list(map(int, input().split())) for _ in [0] * n]
	k = 10000
	ans2 = 0
	for i in range(k):
		t = 2 * i * pi / k
		s = sin(t)
		c = cos(t)
		ans = [0, 0]
		for (a, b) in ab:
			if a * s + b * c >= 0:
				ans[0] += a
				ans[1] += b
		ans2 = max(ans2, ans[0] ** 2 + ans[1] ** 2)
	print(ans2 ** 0.5)
main()


import math
N = int(input())
X = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append((math.atan2(y, x), x, y))
X = sorted(X) * 2
ma = 0
for i in range(N):
	sx = sy = 0
	for j in range(i, i + N):
		sx += X[j][1]
		sy += X[j][2]
		d = sx ** 2 + sy ** 2
		ma = max(ma, d)
print(ma ** 0.5)


import math
N = int(input())
n = 1000
x = [None] * N
y = [None] * N
for i in range(N):
	(x[i], y[i]) = map(int, input().split())
ans = 0
for i in range(n):
	theta = 2 * math.pi / n * i
	c = math.cos(theta)
	s = math.sin(theta)
	tmp_x = 0
	tmp_y = 0
	for j in range(N):
		if x[j] * c + y[j] * s > 0:
			tmp_x += x[j]
			tmp_y += y[j]
	if tmp_x ** 2 + tmp_y ** 2 > ans ** 2:
		ans = math.sqrt(tmp_x ** 2 + tmp_y ** 2)
print(ans)


def f_f():
	import numpy as np
	n = int(input())
	(x, y) = np.array([input().split() for _ in range(n)], dtype='int64').T
	a = np.arctan2(x, y)
	i = a.argsort()
	(x, y, a) = (x[i], y[i], a[i])
	(x, y) = (np.concatenate([x, x]), np.concatenate([y, y]))
	a = np.concatenate([a, a + 2 * np.pi])
	(xcs, ycs) = (x.cumsum(), y.cumsum())
	items = np.arange(1, n + 1)[None, :]
	l = np.arange(n)[:, None]
	dx = xcs[l + items - 1] - xcs[l] + x[l]
	dy = ycs[l + items - 1] - ycs[l] + y[l]
	print((dx * dx + dy * dy).max() ** 0.5)

def __starting_point():
	f_f()
__starting_point()


import math
n = int(input())

def f(x, y):
	return math.atan2(y, x)
XY = []
for i in range(n):
	(x, y) = map(int, input().split())
	XY.append((x, y, f(x, y)))
XY.sort(key=lambda x: x[2])

def dis(x, y):
	return (x ** 2 + y ** 2) ** 0.5
ans = 0
for i in range(n):
	for j in range(1, n + 1):
		(x, y) = (0, 0)
		if i + j <= n:
			for k in range(i, i + j):
				x += XY[k][0]
				y += XY[k][1]
			ans = max(ans, dis(x, y))
		else:
			for k in range(i, n):
				x += XY[k][0]
				y += XY[k][1]
			for k in range(j - (n - i)):
				x += XY[k][0]
				y += XY[k][1]
			ans = max(ans, dis(x, y))
print(ans)


import math
import os
import sys
if os.getenv('LOCAL'):
	sys.stdin = open('_in.txt', 'r')
sys.setrecursionlimit(2147483647)
INF = float('inf')
IINF = 10 ** 18
MOD = 10 ** 9 + 7
N = int(sys.stdin.readline())
XY = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]

def calc(bx, by):
	base = math.atan2(bx, by)
	d1 = []
	d2 = []
	for (x, y) in XY:
		deg = (math.atan2(x, y) - base) % (math.pi * 2)
		if deg < math.pi:
			d1.append((x, y))
		else:
			d2.append((x, y))
	x1 = 0
	y1 = 0
	x2 = 0
	y2 = 0
	for (x, y) in d1:
		x1 += x
		y1 += y
	for (x, y) in d2:
		x2 += x
		y2 += y
	return max(math.sqrt(x1 ** 2 + y1 ** 2), math.sqrt(x2 ** 2 + y2 ** 2))
ans = 0
for (x, y) in XY:
	ans = max(ans, calc(x, y))
print(ans)


import sys
readline = sys.stdin.readline
from math import atan2, hypot
from itertools import accumulate
N = int(readline())
XY = [tuple(map(int, readline().split())) for _ in range(N)]
XY.sort(key=lambda x: atan2(*x))
(X, Y) = list(map(list, zip(*XY)))
(X, Y) = (list(accumulate(X * 2)), list(accumulate(Y * 2)))
ans = 0
for i in range(N):
	for j in range(1, N + 1):
		ans = max(ans, hypot(X[i + j] - X[i], Y[i + j] - Y[i]))
print(ans)


import math
n = int(input())
e = []
for i in range(n):
	(x, y) = map(int, input().split())
	if (x, y) == (0, 0):
		continue
	else:
		t = math.atan2(y, x)
		e.append((x, y, t))
e.sort(key=lambda x: x[2])
n = len(e)
e += e
a = [(0, 0)]
ans = 0
for (x, y, t) in e:
	a += [(a[-1][0] + x, a[-1][1] + y)]
for l in range(n * 2):
	for r in range(l, n * 2):
		if r - l > n:
			continue
		else:
			(x, y) = a[r]
			(w, z) = a[l]
			ans = max((x - w) ** 2 + (y - z) ** 2, ans)
print(ans ** 0.5 if n > 0 else 0)


import math
N = int(input())
P = [list(map(int, input().split())) for i in range(N)]

def div2(x, y):
	if x > 0:
		return (1, y / x)
	elif x < 0:
		return (-1, y / x)
	elif y > 0:
		return (-1, -float('inf'))
	else:
		return (1, -float('inf'))
P.sort(key=lambda x: div2(x[0], x[1]))
ANS = 0
for i in range(N):
	for j in range(i, N):
		x0 = y0 = 0
		x1 = y1 = 0
		for k in range(N):
			if i <= k <= j:
				x0 += P[k][0]
				y0 += P[k][1]
			else:
				x1 += P[k][0]
				y1 += P[k][1]
		ANS = max(ANS, x0 ** 2 + y0 ** 2, x1 ** 2 + y1 ** 2)
print(math.sqrt(ANS))


from math import radians, sin, cos, sqrt
EPS = 1e-10
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for theta in range(0, 3600):
	e = (cos(radians(theta / 10)), sin(radians(theta / 10)))
	(resx, resy) = (0, 0)
	for (x, y) in d:
		if x * e[0] + y * e[1] >= EPS:
			resx += x
			resy += y
	ans = max(ans, sqrt(resx ** 2 + resy ** 2))
print(ans)


import cmath
from math import pi
N = int(input())
p = []
for i in range(N):
	(x, y) = map(int, input().split())
	if (x, y) != (0, 0):
		z = complex(x, y)
		arg = cmath.phase(z)
		p.append((arg, z))
EPS = 10 ** (-6)
N = len(p)
q = [(p[i][0], i) for i in range(N)]
q.sort()
p = [p[q[i][1]] for i in range(N)]
ans = 0
for i in range(N):
	z = 0
	for j in range(N):
		if EPS >= abs(cmath.phase(p[j][1] / p[i][1]) - pi / 2) - pi / 2 and abs(cmath.phase(p[j][1] / p[i][1])) - pi < EPS and (not abs(cmath.phase(p[j][1] / p[i][1])) < EPS):
			z += p[j][1]
	ans = max(ans, abs(z))
for i in range(N):
	z = 0
	for j in range(N):
		if EPS >= abs(cmath.phase(p[j][1] / p[i][1]) - pi / 2) - pi / 2 and abs(cmath.phase(p[j][1] / p[i][1])) - pi < EPS:
			z += p[j][1]
	ans = max(ans, abs(z))
for i in range(N):
	z = 0
	for j in range(N):
		if EPS >= abs(cmath.phase(p[j][1] / p[i][1]) + pi / 2) - pi / 2 and abs(cmath.phase(p[j][1] / p[i][1])) - pi < EPS and (not abs(cmath.phase(p[j][1] / p[i][1])) < EPS):
			z += p[j][1]
	ans = max(ans, abs(z))
for i in range(N):
	z = 0
	for j in range(N):
		if EPS >= abs(cmath.phase(p[j][1] / p[i][1]) + pi / 2) - pi / 2 and abs(cmath.phase(p[j][1] / p[i][1])) - pi < EPS:
			z += p[j][1]
	ans = max(ans, abs(z))
print(ans)


import numpy as np
N = int(input())
XY = np.array([list(map(int, input().split())) for _ in [0] * N])
th = np.arctan2(XY[:, 1], XY[:, 0])
XY = XY[th.argsort()]
ans = 0
n = np.linalg.norm
s = np.sum
for i in range(N):
	for j in range(i + 1, i + N + 1):
		r = n(s(XY[i:j], axis=0) + s(XY[:max(0, j - N)], axis=0))
		ans = max(ans, r)
print(ans)


from cmath import phase
(N, *XY) = map(int, open(0).read().split())
XY = sorted((complex(x, y) for (x, y) in zip(*[iter(XY)] * 2)), key=phase)
XY += XY
print(max((abs(sum(XY[i:j])) for i in range(2 * N + 1) for j in range(2 * N + 1) if j - i <= N)))


from math import sin, cos, pi
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
R = []
e = 1e-05
for n in range(10 ** 5 + 1):
	R.append([cos(2 * pi * n / 10 ** 5), sin(2 * pi * n / 10 ** 5)])
ans = 0
for (Rx, Ry) in R:
	X = 0
	Y = 0
	for (x, y) in xy:
		if Rx * x + Ry * y > 0:
			X += x
			Y += y
	ans = max(ans, (X ** 2 + Y ** 2) ** 0.5)
print(ans)


def f_engines():
	import math
	N = int(input())
	Engines = sorted([[int(i) for i in input().split()] for j in range(N)], key=lambda x: math.atan2(x[1], x[0])) * 2
	ans = 0
	for head in range(N):
		for tail in range(head, head + N):
			(x, y) = (0, 0)
			for i in range(head, tail + 1):
				(dx, dy) = Engines[i]
				x += dx
				y += dy
			ans = max(ans, x * x + y * y)
	return math.sqrt(ans)
print(f_engines())


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
n = ii()
import math
a = []
for i in range(n):
	(x, y) = mi()
	x += 1e-15
	theta = math.degrees(math.atan2(y, x))
	a.append([theta, x, y])
a.sort()
a2 = list(a)
a = a + a2
import numpy as np
x = []
y = []
for i in range(len(a)):
	x.append(a[i][1])
	y.append(a[i][2])
x = np.array(x)
y = np.array(y)
xsum = np.cumsum(x)
ysum = np.cumsum(y)
ans = 0
for i in range(1, n + 1):
	for k in range(i, n + i):
		xtmp = xsum[k] - xsum[i - 1]
		ytmp = ysum[k] - ysum[i - 1]
		tmp = (xtmp ** 2 + ytmp ** 2) ** 0.5
		ans = max(ans, tmp)
print(ans)


import numpy as np
n = int(input())

def div2(x, y):
	if x > 0:
		return (1, y / x)
	elif x < 0:
		return (-1, y / x)
	elif y > 0:
		return (-1, -float('inf'))
	else:
		return (1, -float('inf'))
L = [list(map(int, input().split())) for i in range(n)]
L.sort(key=lambda x: div2(x[0], x[1]))
m = 0
for i in range(n):
	for j in range(i, n):
		x0 = y0 = 0
		x1 = y1 = 0
		for k in range(n):
			if i <= k <= j:
				x0 += L[k][0]
				y0 += L[k][1]
			else:
				x1 += L[k][0]
				y1 += L[k][1]
		m = max(m, x0 ** 2 + y0 ** 2, x1 ** 2 + y1 ** 2)
print('{:.12f}'.format(np.sqrt(m)))


from math import atan2, pi, sqrt
from operator import itemgetter
import sys
input = sys.stdin.readline
n = int(input())
p = []
xa = ya = 0
for i in range(n):
	(x, y) = list(map(int, input().split()))
	angle = atan2(y, x)
	p.append((x, y, angle))
	p.append((x, y, angle + 2 * pi))
	xa += x
	ya += y
p.sort(key=itemgetter(2))
r = 0
ans = 0
xs = ys = 0
for l in range(n):
	while p[r][2] < p[l][2] + pi:
		xs += p[r][0]
		ys += p[r][1]
		r += 1
	ans = max(ans, sqrt(xs ** 2 + ys ** 2), sqrt((xa - xs) ** 2 + (ya - ys) ** 2))
	xs -= p[l][0]
	ys -= p[l][1]
print(ans)


import cmath
import math
n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a.append(complex(x, y))
	b.append(cmath.phase(a[i]))
ma = 0
for i in range(n):
	z = a[i]
	c = b[i] - math.pi / 2
	d = b[i] + math.pi / 2
	l = max([c, -math.pi])
	r = min([d, math.pi])
	if a[i] != complex(0, 0):
		for j in range(n):
			if j != i:
				if l <= b[j] <= r or (c <= -math.pi and c + 2 * math.pi <= b[j] <= math.pi) or (d >= math.pi and -math.pi <= b[j] <= d - 2 * math.pi):
					z += a[j]
	ma = max([abs(z), ma])
m = 0
for i in range(n):
	if a[i] != complex(0, 0):
		(za, zb) = (complex(0, 0), complex(0, 0))
		for j in range(n):
			p = cmath.phase(a[j] / a[i])
			if -math.pi <= p <= 0:
				za += a[j]
			if 0 <= p <= math.pi:
				zb += a[j]
		m = max([m, abs(za), abs(zb)])
		if i != n - 1 and a[i] + a[i + 1] != 0:
			(zc, zd) = (complex(0, 0), complex(0, 0))
			for j in range(n):
				p = cmath.phase(a[j] / ((a[i] + a[i + 1]) / 2))
				if -math.pi <= p <= 0:
					zc += a[j]
				if 0 <= p <= math.pi:
					zd += a[j]
			m = max([m, abs(zc), abs(zd)])
print(max([m, ma]))


import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
INF = float('inf')
import math

def sol():
	N = int(input())
	engine = [tuple(map(int, input().split())) for _ in range(N)]
	ans = 0
	for direct in range(0, 1000):
		direct = 2 * math.pi / 999 * direct
		(u, v) = (math.cos(direct), math.sin(direct))
		length = [0, 0]
		for (x, y) in engine:
			if u * x + v * y >= 0:
				length[0] += x
				length[1] += y
		ans = max(ans, length[0] ** 2 + length[1] ** 2)
	print(ans ** 0.5)
sol()


def main():
	import sys
	from math import atan2, hypot, pi
	from bisect import bisect_left
	input = sys.stdin.readline
	eps = 10 ** (-8)
	N = int(input())
	P = []
	rad = []
	for _ in range(N):
		(x, y) = map(int, input().split())
		P.append((atan2(y, x), x, y))
		rad.append(atan2(y, x))
	P.sort(key=lambda p: p[0])
	rad.sort()
	for i in range(N):
		(r, x, y) = P[i]
		P.append((r + pi * 2, x, y))
		rad.append(r + pi * 2)
	ans = 0
	for i in range(N):
		rad_op = rad[i] + pi
		j = bisect_left(rad, rad_op)
		xsum = ysum = 0
		for k in range(i, j):
			(x, y) = (P[k][1], P[k][2])
			xsum += x
			ysum += y
		ans = max(ans, hypot(xsum, ysum))
		xsum -= P[i][1]
		ysum -= P[i][2]
		ans = max(ans, hypot(xsum, ysum))
	for i in range(N, N * 2):
		rad_op = rad[i] - pi
		j = bisect_left(rad, rad_op)
		xsum = ysum = 0
		for k in range(j, i + 1):
			(x, y) = (P[k][1], P[k][2])
			xsum += x
			ysum += y
		ans = max(ans, hypot(xsum, ysum))
	print(ans)
main()


def examA():
	N = I()
	ans = 0
	print(ans)
	return

def examB():
	ans = 0
	print(ans)
	return

def examC():
	ans = 0
	print(ans)
	return

def examD():
	ans = 0
	print(ans)
	return

def examE():
	N = I()
	node = N * (N - 1) // 2
	V = [[] for _ in range(node)]
	D = [[0] * N for _ in range(N)]
	cur = 0
	for i in range(N):
		for j in range(i + 1, N):
			D[i][j] = cur
			D[j][i] = cur
			cur += 1
	for i in range(N):
		a = LI()
		for j in range(N - 2):
			fr = D[i][a[j] - 1]
			to = D[i][a[j + 1] - 1]
			V[fr].append(to)
	visited = [False] * node
	calculated = [False] * node
	dp = [1] * node

	def dfs(v):
		if visited[v]:
			if not calculated[v]:
				return -1
			return dp[v]
		visited[v] = True
		for u in V[v]:
			res = dfs(u)
			if res == -1:
				return -1
			elif res + 1 > dp[v]:
				dp[v] = res + 1
		calculated[v] = True
		return dp[v]
	ans = 0
	for i in range(node):
		res = dfs(i)
		ans = max(ans, res)
		if res == -1:
			print('-1')
			return
	print(ans)
	return

def examF():

	def calc_L(a, b):
		return (a ** 2 + b ** 2) ** (1 / 2)
	N = I()
	X = [[] for _ in range(N)]
	for i in range(N):
		(x, y) = LI()
		d = math.degrees(math.atan2(y, x))
		if d < 0:
			d += 360
		X[i] = [d, x, y]
	X.sort()
	ans = 0
	for i in range(N):
		cur_X = 0
		cur_Y = 0
		for (d2, x2, y2) in X[i:] + X[:i]:
			if calc_L(cur_X + x2, cur_Y + y2) < calc_L(cur_X, cur_Y):
				continue
			cur_X += x2
			cur_Y += y2
		now = calc_L(cur_X, cur_Y)
		if now > ans:
			ans = now
	print(ans)
	return
import sys, copy, bisect, itertools, heapq, math, random
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
sys.setrecursionlimit(10 ** 6)
examF()


from math import radians, sin, cos, sqrt
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for theta in range(3600):
	(ansx, ansy) = (0, 0)
	e = [cos(radians(theta / 10)), sin(radians(theta / 10))]
	for (x, y) in a:
		pr = x * e[0] + y * e[1]
		if pr > 1e-10:
			ansx += x
			ansy += y
	ans = max(ans, sqrt(ansx ** 2 + ansy ** 2))
print(ans)


from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return [list(x) for x in sys.stdin.readline().split()]

def S():
	res = list(sys.stdin.readline())
	if res[-1] == '\n':
		return res[:-1]
	return res

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
	n = I()
	p = LIR(n)
	p.sort(key=lambda x: math.atan2(x[1], x[0]))
	p += p
	ans = 0
	for i in range(n):
		m = [0, 0]
		for j in range(i, i + n):
			m[0] += p[j][0]
			m[1] += p[j][1]
			d = m[0] ** 2 + m[1] ** 2
			if ans < d:
				ans = d
	print(ans ** 0.5)
	return
solve()


n = int(input())
l = [list(map(int, input().split())) for _ in [0] * n]
l1 = []
l2 = []
l3 = []
l4 = []
for i in range(n):
	if l[i][0] == 0:
		if l[i][1] > 0:
			l1.append(l[i])
		else:
			l3.append(l[i])
	elif l[i][0] < 0:
		l2.append(l[i])
	else:
		l4.append(l[i])
L = l1 + sorted(l2, key=lambda x: x[1] / x[0]) + l3 + sorted(l4, key=lambda x: x[1] / x[0])
L = [[0, 0]] + L * 2
for i in range(1, n * 2 + 1):
	L[i] = [L[i - 1][0] + L[i][0], L[i - 1][1] + L[i][1]]
ans = 0
for i in range(n + 1):
	for j in range(i, i + n + 1):
		ans = max(ans, (L[j][0] - L[i][0]) ** 2 + (L[j][1] - L[i][1]) ** 2)
print(ans ** 0.5)


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

def LI():
	return list(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def LS():
	return list(map(list, input().split()))

def S():
	return list(input().rstrip())

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')
import time

def A():
	s = S()
	t = S()
	ans = 0
	for i in range(3):
		if s[i] == t[i]:
			ans += 1
	print(ans)
	return

def B():
	(a, b) = LI()
	ans = 0
	b -= 1
	while b > 0:
		b -= a - 1
		ans += 1
	print(ans)
	return

def C():
	n = II()
	h = LI()
	i = 0
	ans = 0
	while i < n:
		down = i + 1
		while down < n:
			if h[down - 1] >= h[down]:
				down += 1
			else:
				break
		ans = max(ans, down - i - 1)
		i = down
	print(ans)
	return

def D():
	n = II()
	print(n * (n - 1) // 2)
	return

def E():
	start = time.time()
	n = II()
	a = LIR_(n)
	ans = 0
	tern = [0] * n
	while 1:
		ans += 1
		f = True
		c = defaultdict(int)
		for i in range(n):
			if c[i]:
				continue
			if tern[i] == n - 1:
				continue
			rival = a[i][tern[i]]
			if c[rival]:
				continue
			if tern[rival] == n - 1:
				continue
			if a[rival][tern[rival]] == i:
				c[i] += 1
				c[rival] += 1
				tern[rival] += 1
				tern[i] += 1
				f = False
		if time.time() - start >= 1:
			print(n * (n - 1) // 2)
			return
		if f:
			if tern == [n - 1] * n:
				print(ans - 1)
				return
			else:
				print(-1)
				return
	return

def F():
	n = II()
	lis = []
	for _ in range(n):
		(x, y) = LI()
		arg = math.atan2(y, x) / math.pi * 180
		lis.append((arg, x, y))
		lis.append((arg + 360, x, y))
	lis.sort()
	i = 0
	k = 0
	tmpx = 0
	tmpy = 0
	ans = 0
	while i < n:
		(arg, x, y) = lis[i]
		while k < 2 * n:
			(karg, kx, ky) = lis[k]
			if karg < arg + 180:
				tmpx += kx
				tmpy += ky
				ans = max(ans, sqrt(tmpx ** 2 + tmpy ** 2))
				k += 1
			else:
				tmpx -= x
				tmpy -= y
				ans = max(ans, sqrt(tmpx ** 2 + tmpy ** 2))
				break
		i += 1
	print(ans)
	return
F()


import cmath
N = int(input())
XY = []
for _ in range(N):
	(x, y) = list(map(int, input().split()))
	XY.append(x + y * 1j)
XY.sort(key=lambda x: cmath.phase(x))
ans = 0
for i in range(N):
	for j in range(N):
		if i <= j:
			ans = max(ans, abs(sum(XY[i:j + 1])))
		elif i > j:
			ans = max(ans, abs(sum(XY[:j + 1] + XY[i:])))
print(ans)


n = int(input())
pi = 3.141592653589793
xy = [list(map(int, input().split())) for _ in range(n)]
import math
atan = [math.atan2(x[0], x[1]) for x in xy]
d = []

def hoge(a):
	ret = 0
	if a % (2 * pi) < pi:
		ret = a % pi
	elif a % (2 * pi) > pi:
		ret = a % pi - pi
	else:
		ret = a
	return ret

def seikika(A):
	ret = []
	for a in A:
		ret.append(hoge(a))
	return ret
gyoukaku = atan.copy()
gyoukaku.extend(seikika([a + pi for a in atan]))
M = 60
for m in range(M):
	gyoukaku.extend(seikika([a + pi * (2 * pi / M * m) for a in atan]))

def dist(xy):
	xx = sum([x[0] for x in xy])
	yy = sum([y[1] for y in xy])
	return (xx ** 2 + yy ** 2) ** 0.5
for g in gyoukaku:
	anglist = seikika([hoge(a - g) for a in atan])
	anglist = seikika(anglist)
	finalxy = []
	for i in range(n):
		if -pi / 2 - 1e-06 <= anglist[i] <= pi / 2 + 1e-06:
			finalxy.append(xy[i])
	d.append(dist(finalxy))
print(max(d))


import math

def calc_angle(X, Y):
	assert X != 0 or Y != 0
	TREND_INF = 10 ** 6 + 1
	if X == 0:
		angle = math.atan(TREND_INF)
		if Y < 0:
			angle += math.pi
	else:
		angle = math.atan(Y / X)
		if X < 0:
			angle += math.pi
	return angle

def main():
	N = int(input())
	engines = list()
	for _ in range(N):
		(X, Y) = list(map(int, input().split(' ')))
		if X == Y == 0:
			continue
		angle = calc_angle(X, Y)
		engines.append((angle, X, Y))
	N = len(engines)
	if N == 0:
		print(0)
		return
	engines.sort()
	dist = [[0 for _ in range(N)] for _ in range(N)]
	for i in range(N):
		for j in range(N):
			k = i
			sx = engines[k][1]
			sy = engines[k][2]
			while k != j:
				k = (k + 1) % N
				sx += engines[k][1]
				sy += engines[k][2]
			dist[i][j] = math.sqrt(sx ** 2 + sy ** 2)
	ans = 0
	for i in range(N):
		for j in range(N):
			ans = max(ans, dist[i][j])
	print(ans)
main()


import math
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
	x = math.degrees(math.atan2(l[i][1], l[i][0]))
	l[i] = [x, l[i][0], l[i][1]]
l.sort()
L = l + l
ansL = []
for i in range(n):
	for j in range(i, n + i):
		ctx = 0
		cty = 0
		for k in range(i, j + 1):
			ctx += L[k][1]
			cty += L[k][2]
		ansL.append((ctx ** 2 + cty ** 2) ** 0.5)
print(max(ansL))


L = 10 ** 10
N = int(input())
(x, y) = zip(*(map(int, input().split()) for _ in range(N)))
result = 0
for i in range(N):
	for b in [-1, 1]:
		for (s, t) in [(y[i], -x[i]), (-y[i], x[i])]:
			(s, t) = (L * s - b * t, b * s + L * t)
			X = 0
			Y = 0
			for j in range(N):
				if x[j] * s + y[j] * t > 0:
					X += x[j]
					Y += y[j]
			result = max(result, (X ** 2 + Y ** 2) ** 0.5)
print(result)


from math import atan2
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
l.sort(key=lambda x: atan2(x[1], x[0]))
ans = 0
for i in range(n):
	(x, y) = (0, 0)
	for j in range(n):
		(x1, y1) = l[(i + j) % n]
		x += x1
		y += y1
		ans = max(x ** 2 + y ** 2, ans)
print(ans ** 0.5)


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
R = []
e = 1e-05
for (x, y) in xy:
	R.append([x, y])
	R.append([-x, -y])
	R.append([y, -x])
	R.append([-y, x])
	R.append([x + e, y + e])
	R.append([-x - e, -y - e])
	R.append([y + e, -x - e])
	R.append([-y - e, x + e])
	R.append([x + e, y - e])
	R.append([-x - e, -y + e])
	R.append([y - e, -x - e])
	R.append([-y + e, x + e])
	R.append([x - e, y + e])
	R.append([-x + e, -y - e])
	R.append([y + e, -x + e])
	R.append([-y - e, x - e])
	R.append([x - e, y - e])
	R.append([-x + e, -y + e])
	R.append([y - e, -x + e])
	R.append([-y + e, x - e])
ans = 0
for (Rx, Ry) in R:
	X = 0
	Y = 0
	for (x, y) in xy:
		if Rx * x + Ry * y > 0:
			X += x
			Y += y
	ans = max(ans, (X ** 2 + Y ** 2) ** 0.5)
print(ans)


import sys
from operator import itemgetter
import math
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

def main():
	N = int(input())
	XY = [[int(x) for x in input().split()] for _ in range(N)]
	txy = []
	for (x, y) in XY:
		t = math.atan2(x, y)
		txy.append([t, x, y])
	txy.sort()
	ans = 0
	for i in range(N):
		tmpx = 0
		tmpy = 0
		for j in range(N):
			tmpx += txy[(i + j) % N][1]
			tmpy += txy[(i + j) % N][2]
			ans = max(ans, math.sqrt(tmpx ** 2 + tmpy ** 2))
	print(ans)
main()


import cmath
import math
N = int(input())
pc = []
for i in range(N):
	(x, y) = list(map(int, input().split()))
	c = x + y * 1j
	p = cmath.phase(c)
	pc.append([p, c])
pc = sorted(pc, key=lambda x: x[0])
ps = [pc[i][0] for i in range(N)]
cs = [pc[i][1] for i in range(N)]

def L(i, j, N):
	if i < j:
		return list(range(i, j))
	else:
		return list(range(0, j)) + list(range(i + 1, N))
s = 0
m = 0
for start in range(N):
	for end in range(N):
		s = 0
		for k in L(start, end, N):
			s += cs[k]
		m = max(m, abs(s))
s = 0
for k in range(N):
	s += cs[k]
	m = max(m, abs(s))
print(m)


import sys
import math
import numpy as np

def main():
	n = int(input())
	vec = [tuple(map(int, input().split())) for i in range(n)]
	vec.sort(key=lambda x: math.atan2(x[1], x[0]))
	maxx = 0
	for i in range(n):
		for j in range(1, n + 1):
			now = [0, 0]
			for k in range(j):
				idx = (i + k) % n
				now[0] += vec[idx][0]
				now[1] += vec[idx][1]
			maxx = max(maxx, now[0] * now[0] + now[1] * now[1])
	print(math.sqrt(maxx))
	return 0

def __starting_point():
	return main()
__starting_point()


N = int(input())
sxy41 = []
sxy23 = []
for i in range(N):
	(x, y) = list(map(int, input().split()))
	if x == 0 and y >= 0:
		s = float('inf')
	elif x == 0 and y < 0:
		s = -1 * float('inf')
	else:
		s = y / x
	if x >= 0:
		sxy41.append([s, x, y])
	else:
		sxy23.append([s, x, y])
sxy41.sort()
sxy23.sort()
sxy = []
for i in sxy41:
	sxy.append(i)
for i in sxy23:
	sxy.append(i)
ans = 0
for i in range(N):
	for j in range(i):
		nowx = 0
		nowy = 0
		for k in range(i - j + 1):
			k += j
			nowx += sxy[k][1]
			nowy += sxy[k][2]
		ans = max(ans, (nowx ** 2 + nowy ** 2) ** 0.5)
sxy = []
for i in sxy23:
	sxy.append(i)
for i in sxy41:
	sxy.append(i)
for i in range(N):
	for j in range(i + 1):
		nowx = 0
		nowy = 0
		for k in range(i - j + 1):
			k += j
			nowx += sxy[k][1]
			nowy += sxy[k][2]
		ans = max(ans, (nowx ** 2 + nowy ** 2) ** 0.5)
print(ans)


import sys
from math import atan2, degrees, hypot

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return list(map(int, input().split()))

def LIST():
	return list(map(int, input().split()))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** (-9)
N = INT()
degs = []
XY = []
for i in range(N):
	(x, y) = MAP()
	XY.append((x, y))
	deg = degrees(atan2(y, x))
	if deg < 0:
		deg += 360
	degs.append((deg, i))
degs.sort()
degs += [(deg + 360, i) for (deg, i) in degs]
ans = 0
for i in range(N):
	(deg, idx) = degs[i]
	(xsm, ysm) = XY[idx]
	ans = max(ans, hypot(xsm, ysm))
	j = i + 1
	while degs[j][0] < deg + 180:
		(_, idx) = degs[j]
		(x, y) = XY[idx]
		xsm += x
		ysm += y
		ans = max(ans, hypot(xsm, ysm))
		j += 1
print(ans)


import math
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
test_case = []
for i in range(n):
	(x, y) = xy[i]
	test_case.append((y, -x))
	test_case.append((-y, x))
ret = 0
for (nx, ny) in test_case:
	(sx, sy) = (0, 0)
	for j in range(n):
		(x, y) = xy[j]
		if nx * x + ny * y > 0 or (nx * x + ny * y == 0 and -ny * x + nx * y >= 0):
			sx += x
			sy += y
	ret = max(ret, math.hypot(sx, sy))
print(ret)


import sys

def I():
	return int(sys.stdin.readline().rstrip())

def MI():
	return map(int, sys.stdin.readline().rstrip().split())
N = I()
xy = [tuple(MI()) for i in range(N)]
from math import gcd, sqrt
ans = 0
for i in range(N):
	(x, y) = xy[i]
	(X1, Y1) = (0, 0)
	(X2, Y2) = (0, 0)
	(X3, Y3) = (0, 0)
	(X4, Y4) = (0, 0)
	if x == 0 and y == 0:
		continue
	else:
		for j in range(N):
			(a, b) = xy[j]
			if a == 0 and b == 0:
				continue
			elif x // gcd(x, y) == a // gcd(a, b) and y // gcd(x, y) == b // gcd(a, b):
				X1 += a
				Y1 += b
				X2 += a
				Y2 += b
			elif -y * a + x * b > 0:
				X1 += a
				Y1 += b
				X3 += a
				Y3 += b
			elif y * a + -x * b > 0:
				X2 += a
				Y2 += b
				X4 += a
				Y4 += b
		ans = max(ans, X1 ** 2 + Y1 ** 2, X2 ** 2 + Y2 ** 2, X3 ** 2 + Y3 ** 2, X4 ** 2 + Y4 ** 2)
print(sqrt(ans))


import math
N = int(input())
xy = []
for i in range(N):
	(x, y) = map(int, input().split())
	xy += [(x, y, math.atan2(y, x))]
xy.sort(key=lambda val: val[2])
x_accum = [0]
y_accum = [0]
for i in range(N):
	x_accum += [x_accum[-1] + xy[i][0]]
	y_accum += [y_accum[-1] + xy[i][1]]
ans = 0
for i in range(N + 1):
	for j in range(i, N + 1):
		ans = max(ans, math.hypot(x_accum[j] - x_accum[i], y_accum[j] - y_accum[i]))
		ans = max(ans, math.hypot(x_accum[-1] - x_accum[j] + x_accum[i], y_accum[-1] - y_accum[j] + y_accum[i]))
print(ans)


import sys
import math
input = sys.stdin.readline
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
txy = sorted([(math.atan2(y, x), x, y) for (x, y) in xy])
txy += txy
i = 0
ans = 0
for i in range(N):
	for j in range(i, 2 * N):
		if j - i > N:
			continue
		xs = sum(map(lambda x: x[1], txy[i:j]))
		ys = sum(map(lambda x: x[2], txy[i:j]))
		ans = max(ans, math.sqrt(xs * xs + ys * ys))
print(ans)


import math
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(100):
	x = math.cos(2 * math.pi * i / 100)
	y = math.sin(2 * math.pi * i / 100)
	x1 = 0
	y1 = 0
	for j in range(N):
		if x * A[j][0] + y * A[j][1] >= 0:
			x1 += A[j][0]
			y1 += A[j][1]
	ans1 = (x1 ** 2 + y1 ** 2) ** (1 / 2)
	ans = max(ans, ans1)
print(ans)


N = int(input())
X = []
for _ in range(N):
	(x, y) = map(int, input().split())
	s = 1 if x < 0 else 0
	r = y / (x + 10 ** (-100))
	X.append((s, r, x, y))
X = sorted(X) * 2
ma = 0
for i in range(N):
	(sx, sy) = (0, 0)
	for j in range(i, i + N):
		sx += X[j][2]
		sy += X[j][3]
		d = sx ** 2 + sy ** 2
		ma = max(ma, d)
print(ma ** 0.5)


import math
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
test_case = []
for x in (-1, 0, 1):
	for y in (-1, 0, 1):
		test_case.append((x, y))
for i in range(n):
	(x1, y1) = xy[i]
	test_case.append((x1, y1))
	test_case.append((-x1, -y1))
	test_case.append((y1, -x1))
	test_case.append((-y1, x1))
ret = 0
for (x1, y1) in test_case:
	(sx, sy, tx, ty) = (0, 0, 0, 0)
	for j in range(n):
		(x2, y2) = xy[j]
		if x1 * x2 + y1 * y2 > 0 or (x1 * x2 + y1 * y2 == 0 and -y1 * x2 + x1 * y2 >= 0):
			sx += x2
			sy += y2
		else:
			tx += x2
			ty += y2
	ret = max(ret, math.hypot(sx, sy), math.hypot(tx, ty))
print(ret)


import math
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
ans = 0
L = 10 ** 5
for i in range(L):
	(x, y) = [math.cos(2 * math.pi * i / L), math.sin(2 * math.pi * i / L)]
	(tmpx, tmpy) = (0, 0)
	for j in range(N):
		(xj, yj) = XY[j]
		if x * xj + y * yj > 0:
			tmpx += xj
			tmpy += yj
	ans = max(ans, math.sqrt(tmpx * tmpx + tmpy * tmpy))
print(ans)


import sys
from operator import itemgetter
import math
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

def main():
	N = int(input())
	XY = [[int(x) for x in input().split()] for _ in range(N)]
	ans = 0
	for (i, (x, y)) in enumerate(XY):
		if x == 0:
			katamuki = 1 / 10 ** 7
			katamuki2 = -1 / 10 ** 7
		else:
			katamuki = y / x + 1 / 10 ** 7
			katamuki2 = y / x - 1 / 10 ** 7
		plus = [0, 0]
		minus = [0, 0]
		plus2 = [0, 0]
		minus2 = [0, 0]
		for (j, (xx, yy)) in enumerate(XY):
			if yy > katamuki * xx:
				plus[0] += xx
				plus[1] += yy
			else:
				minus[0] += xx
				minus[1] += yy
			if yy > katamuki2 * xx:
				plus2[0] += xx
				plus2[1] += yy
			else:
				minus2[0] += xx
				minus2[1] += yy
		ans = max(ans, math.sqrt(plus[0] ** 2 + plus[1] ** 2))
		ans = max(ans, math.sqrt(minus[0] ** 2 + minus[1] ** 2))
		ans = max(ans, math.sqrt(plus2[0] ** 2 + plus2[1] ** 2))
		ans = max(ans, math.sqrt(minus2[0] ** 2 + minus2[1] ** 2))
	print(ans)
main()


def i1():
	return int(input())

def i2():
	return [int(i) for i in input().split()]
import math
N = i1()
x = []
for i in range(N):
	z = i2()
	x.append([math.atan2(z[1], z[0]), z])
x.sort()
a = 0
for i in range(N):
	s1 = [0, 0]
	aa = 0
	for j in range(N):
		y1 = (i + j) % N
		s1[0] += x[y1][1][0]
		s1[1] += x[y1][1][1]
		aa = max(aa, math.sqrt(s1[0] ** 2 + s1[1] ** 2))
	a = max(a, aa)
print(a)


import math

def main():
	N = int(input())
	E = []
	for i in range(N):
		(x, y) = map(int, input().split())
		E.append((math.atan2(y, x), x, y))
	E = sorted(E) * 2
	answer = 0
	for i in range(N):
		x = 0
		y = 0
		for j in range(i, i + N):
			x += E[j][1]
			y += E[j][2]
			answer = max(answer, x * x + y * y)
	answer = math.sqrt(answer)
	print(answer)
main()


from math import atan2, pi
N = int(input())
engines = []
total_X = total_Y = 0
for i in range(N):
	(x, y) = map(int, input().split())
	engines.append((atan2(y, x), x, y))
	total_X += x
	total_Y += y
engines.sort()
ans2 = 0
l = r = 0
X = engines[0][1]
Y = engines[0][2]
for l in range(N):
	theta = engines[l][0]
	(xl, yl) = engines[l][1:]
	while r + 1 - l < N and (theta <= engines[(r + 1) % N][0] < theta + pi or theta <= engines[(r + 1) % N][0] + 2 * pi < theta + pi):
		r += 1
		X += engines[r % N][1]
		Y += engines[r % N][2]
	ans2 = max(ans2, X ** 2 + Y ** 2, (total_X - X) ** 2 + (total_Y - Y) ** 2)
	while r + 1 - l < N and (theta <= engines[(r + 1) % N][0] <= theta + pi or theta <= engines[(r + 1) % N][0] + 2 * pi <= theta + pi):
		r += 1
		X += engines[r % N][1]
		Y += engines[r % N][2]
	ans2 = max(ans2, X ** 2 + Y ** 2, (total_X - X) ** 2 + (total_Y - Y) ** 2)
	X -= xl
	Y -= yl
print(ans2 ** 0.5)


import sys
import math
from collections import deque
input = sys.stdin.readline

def solve(n, x_y_list):
	radians = [(math.atan2(y, x), x, y) for (x, y) in x_y_list]
	radians.sort()
	radians = radians + radians
	max_square_distance = 0
	for start in range(n):
		sum_x = sum_y = 0
		for i in range(n):
			(_, x, y) = radians[start + i]
			sum_x += x
			sum_y += y
			square_distance = sum_x ** 2 + sum_y ** 2
			if max_square_distance < square_distance:
				max_square_distance = square_distance
	return math.sqrt(max_square_distance)

def __starting_point():
	n = int(input())
	x_y_list = [tuple(map(int, input().split())) for _ in range(n)]
	answer = solve(n, x_y_list)
	print(answer)
__starting_point()


from math import hypot
N = int(input())
engines = [tuple(map(int, input().split())) for _ in range(N)]

def dot(x1, y1, x2, y2):
	return x1 * x2 + y1 * y2

def cross(x1, y1, x2, y2):
	return x1 * y2 - y1 * x2

def getDistMax(xBase, yBase):
	(x1s, y1s, x2s, y2s) = ([], [], [], [])
	(x, y) = (0, 0)
	for (dx, dy) in engines:
		d = dot(xBase, yBase, dx, dy)
		if d > 0:
			(x, y) = (x + dx, y + dy)
		elif d == 0:
			c = cross(xBase, yBase, dx, dy)
			if c > 0:
				x1s.append(dx)
				y1s.append(dy)
			else:
				x2s.append(dx)
				y2s.append(dy)
	ans = max(hypot(x, y), hypot(x + sum(x1s), y + sum(y1s)), hypot(x + sum(x2s), y + sum(y2s)))
	return ans
ans = 0
for (x, y) in engines:
	ds = []
	ds.append(getDistMax(x, y))
	ds.append(getDistMax(-y, x))
	ds.append(getDistMax(-x, -y))
	ds.append(getDistMax(y, -x))
	ans = max(ans, max(ds))
print(ans)


import sys
input = sys.stdin.readline
import math
from collections import deque
from operator import itemgetter
N = int(input())
XY1 = []
XY2 = []
for _ in range(N):
	(x, y) = map(int, input().split())
	theta = math.atan2(y, x)
	if y == 0 and x < 0:
		theta -= 2 * math.pi
	if theta < 0:
		XY1.append((x, y, theta))
	else:
		XY2.append((x, y, theta))
XY1.sort(key=itemgetter(2))
XY2.sort(key=itemgetter(2))
q1 = deque()
q2 = deque()
for xy1 in XY1:
	q1.append(xy1)
for xy2 in XY2:
	q2.append(xy2)
ans = 0
for _ in range(N + 4):
	(px, py) = (0, 0)
	(mx, my) = (0, 0)
	for xy1 in q1:
		px += xy1[0]
		py += xy1[1]
	for xy2 in q2:
		mx += xy2[0]
		my += xy2[1]
	dp = math.sqrt(px ** 2 + py ** 2)
	if dp > ans:
		ans = dp
	dm = math.sqrt(mx ** 2 + my ** 2)
	if dm > ans:
		ans = dm
	if len(q1) == 0:
		xy2 = q2.popleft()
		q1.append(xy2)
	elif len(q2) == 0:
		xy1 = q1.popleft()
		q2.append(xy1)
	else:
		xy1 = q1[0]
		xy2 = q2[0]
		theta1 = xy1[2]
		theta2 = xy2[2]
		if theta1 + math.pi < theta2:
			q1.popleft()
			q2.append((xy1[0], xy1[1], theta1 + 2 * math.pi))
		else:
			q2.popleft()
			q1.append((xy2[0], xy2[1], theta2))
print(ans)


import math

def f(a, b):
	if a + 90 >= b and a - 90 <= b:
		return True
	if a + 270 <= b and b <= 180:
		return True
	if a - 270 >= b and b >= -180:
		return True
	return False
n = int(input())
xy = []
ang = []
for _ in range(n):
	(x, y) = map(int, input().split())
	xy.append((x, y))
	ang.append(math.degrees(math.atan2(y, x)))
res = 0
p = -180.0
d = 360.0 / 1000
for _ in range(1000):
	xx = 0.0
	yy = 0.0
	for (i, e) in enumerate(ang):
		if f(p, e):
			xx += xy[i][0]
			yy += xy[i][1]
	p += d
	tmp = (xx ** 2 + yy ** 2) ** 0.5
	res = max(tmp, res)
print(res)


import sys
sys.setrecursionlimit(10 ** 6)
readline = sys.stdin.readline
from math import atan2, pi
from bisect import *
n = int(input())
ans = 0
txy = []
for _ in range(n):
	(x, y) = [int(i) for i in readline().split()]
	ans = max(ans, x * x + y * y)
	txy.append((atan2(y, x), x, y))
	txy.append((atan2(y, x) + 2 * pi, x, y))
txy.sort()
N = 100000
a = 2 * pi / N
id1 = id2 = 0
for i in range(N):
	r = i * a
	nid1 = bisect(txy, (r, 0, 0))
	nid2 = bisect(txy, (r + pi, 0, 0))
	if id1 == nid1 and id2 == nid2:
		continue
	(id1, id2) = (nid1, nid2)
	rx = ry = 0
	for (t, x, y) in txy[id1:id2]:
		rx += x
		ry += y
	ans = max(ans, rx * rx + ry * ry)
print(ans ** 0.5)


from math import *
N = int(input())
data = []
for i in range(N):
	(x, y) = map(int, input().split())
	data.append((atan2(y, x), x, y))
data.sort()
ret = 0
for i in range(N):
	x = data[i][1]
	y = data[i][2]
	ret = max(ret, sqrt(x ** 2 + y ** 2))
for i in range(N):
	for j in range(N):
		if i < j and data[j][0] - data[i][0] < pi:
			x = 0
			y = 0
			for k in range(i, j + 1):
				x += data[k][1]
				y += data[k][2]
			ret = max(ret, sqrt(x ** 2 + y ** 2))
		elif i > j and data[i][0] - data[j][0] >= pi:
			x = 0
			y = 0
			for k in range(i, N):
				x += data[k][1]
				y += data[k][2]
			for k in range(j + 1):
				x += data[k][1]
				y += data[k][2]
			ret = max(ret, sqrt(x ** 2 + y ** 2))
print(ret)


from math import atan2, pi
N = int(input())
dxy = []
for _ in range(N):
	(x, y) = map(int, input().split())
	dxy.append((atan2(y, x), x, y))
dxy.sort()
for i in range(N):
	dxy.append((dxy[i][0] + 2 * pi, dxy[i][1], dxy[i][2]))
M = 0
E = 1e-06
for i in range(N):
	(d, x, y) = (dxy[i][0], 0, 0)
	for j in range(i, 2 * N):
		if dxy[j][0] - d > pi + E:
			break
		x += dxy[j][1]
		y += dxy[j][2]
		M = max(M, x * x + y * y)
print(M ** 0.5)


import math
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
	x = info[i][0]
	y = info[i][1]
	info[i].append(x)
	info[i].append(y)
	info[i][0] = math.atan2(y, x)
	info[i][1] = (x ** 2 + y ** 2) ** 0.5
info.sort()
allx = 0
ally = 0
for i in range(n):
	allx += info[i][2]
	ally += info[i][3]
for i in range(n):
	for j in range(i + 1, n + 1):
		ax = 0
		ay = 0
		for k in range(i, j):
			ax += info[k][2]
			ay += info[k][3]
		ans = max(ans, (ax ** 2 + ay ** 2) ** 0.5, ((allx - ax) ** 2 + (ally - ay) ** 2) ** 0.5)
print(ans)


from itertools import combinations
from cmath import phase
N = int(input())
xy = [complex(*map(int, input().split())) for _ in range(N)]
xy.sort(key=phase)
xy += xy
ans = 0
for (i, j) in combinations(range(N * 2 + 1), 2):
	if j - i <= N:
		ans = max(abs(sum(xy[i:j])), ans)
print(ans)


N = int(input())
points = []
for i in range(N):
	(x, y) = map(int, input().split())
	if (x, y) == (0, 0):
		N -= 1
		continue
	points.append((x, y))
if not points:
	print(0)
	quit()
PI = 3.14
import math
points.sort(key=lambda x: math.atan2(x[0], x[1]))

def calc(points):
	l = 0
	h = 1
	xsum = points[0][0]
	ysum = points[0][1]
	highest = xsum ** 2 + ysum ** 2
	while h < len(points):
		(nx, ny) = (xsum - points[l][0], ysum - points[l][1])
		if not l >= h and nx ** 2 + ny ** 2 > xsum ** 2 + ysum ** 2 or h - l >= N:
			(xsum, ysum) = (nx, ny)
			l += 1
		else:
			xsum += points[h][0]
			ysum += points[h][1]
			h += 1
		highest = max(highest, xsum ** 2 + ysum ** 2)
	return highest

def calc2(points):
	hi = 0
	for s in range(N):
		for j in range(1, N + 1):
			xt = yt = 0
			for x in range(j):
				xt += points[s + x][0]
				yt += points[s + x][1]
			hi = max(hi, xt ** 2 + yt ** 2)
	return hi ** 0.5
print(calc2(points + points))


from math import atan2, sqrt
N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
P.sort(key=lambda p: atan2(p[1], p[0]))
ans = 0
for i in range(N):
	cx = cy = 0
	for j in range(N):
		(x, y) = P[(i + j) % N]
		cx += x
		cy += y
		ans = max(ans, cx ** 2 + cy ** 2)
print('%.16f' % sqrt(ans))


from math import hypot, atan2
N = int(input())
engines = [tuple(map(int, input().split())) for _ in range(N)]
engines.sort(key=lambda z: atan2(z[1], z[0]))
ans = 0
for L in range(N):
	for R in range(N):
		if L <= R:
			(x, y) = map(sum, zip(*engines[L:R + 1]))
		else:
			(x, y) = map(sum, zip(*engines[:R + 1] + engines[L:]))
		dist = hypot(x, y)
		ans = max(ans, dist)
print(ans)


import itertools
from math import atan2, sqrt
N = int(input())
A = [t for _ in range(N) if (t := tuple(map(int, input().split()))) != (0, 0)]
A.sort(key=lambda x: atan2(x[1], x[0]))
(Ax, Ay) = ([], [])
for (_, v) in itertools.groupby(A, key=lambda x: atan2(x[1], x[0])):
	(sx, sy) = (0, 0)
	for (vx, vy) in v:
		sx += vx
		sy += vy
	Ax.append(sx)
	Ay.append(sy)
Nu = len(Ax)
Ax = [0] + list(itertools.accumulate(Ax * 2))
Ay = [0] + list(itertools.accumulate(Ay * 2))
ans = 0
for i in range(Nu + 1):
	for j in range(i + 1, min(i + Nu + 1, 2 * Nu + 1)):
		ans = max(ans, (Ax[j] - Ax[i]) ** 2 + (Ay[j] - Ay[i]) ** 2)
print(sqrt(ans))


from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return [list(x) for x in sys.stdin.readline().split()]

def S():
	res = list(sys.stdin.readline())
	if res[-1] == '\n':
		return res[:-1]
	return res

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007

def A():
	s = S()
	t = S()
	ans = 0
	for i in range(len(s)):
		if s[i] == t[i]:
			ans += 1
	print(ans)
	return

def B():
	(a, b) = LI()
	for i in range(10000):
		if 1 + i * a - i >= b:
			print(i)
			return
	return

def C():
	n = I()
	a = LI()
	ans = 0
	r = 1
	for l in range(n):
		if r == l:
			r += 1
		while r < n and a[r - 1] >= a[r]:
			r += 1
		ans = max(ans, r - l - 1)
	print(ans)
	return

def D():
	n = I()
	print(n * (n - 1) >> 1)
	return

def E():

	def dfs(x, p):
		if dp[x] != None:
			return dp[x]
		dp[x] = -1
		for y in v[x]:
			if p[y]:
				dp[x] = float('inf')
				break
			p[y] = 1
			dp[x] = max(dp[x], dfs(y, p) + 1)
			p[y] = 0
		return dp[x]
	n = I()
	a = LIR(n)
	for i in range(n):
		for j in range(n - 1):
			a[i][j] -= 1
	m = n * (n - 1)
	v = [[] for i in range(m)]
	for i in range(n):
		p = n * min(i, a[i][0]) + max(i, a[i][0])
		for j in range(n - 2):
			p_ = n * min(i, a[i][j + 1]) + max(i, a[i][j + 1])
			v[p_].append(p)
			p = p_
	dp = defaultdict(lambda : None)
	for i in range(m):
		if not v[i]:
			dp[i] = 1
	ans = 1
	p = [0] * m
	for x in range(m):
		p[x] = 1
		if ans < dfs(x, p):
			ans = dp[x]
		p[x] = 0
	if ans == float('inf'):
		print(-1)
	else:
		print(ans)
	return

def E_():
	n = I()
	a = LIR(n)
	for i in range(n):
		for j in range(n - 1):
			a[i][j] -= 1
	m = n * (n - 1)
	v = [[] for i in range(m)]
	f = [0] * m
	for i in range(n):
		p = n * min(i, a[i][0]) + max(i, a[i][0])
		for j in range(n - 2):
			p_ = n * min(i, a[i][j + 1]) + max(i, a[i][j + 1])
			v[p].append(p_)
			f[p] += 1
			p = p_
	q = []
	for i in range(m):
		heappush(q, (f[i], i))
	if q[0][0]:
		print(-1)
		return
	d = [1 if not f[i] else -1 for i in range(m)]
	bfs = [1] * m
	while q:
		(fx, x) = heappop(q)
		if not bfs[x]:
			continue
		bfs[x] = 0
		for y in v[x]:
			d[y] = d[x] + 1
			f[y] -= 1
			if not f[y]:
				heappush(q, (0, y))
	print(d)
	return

def F():
	n = I()
	p = LIR(n)
	p.sort(key=lambda x: math.atan2(x[1], x[0]))
	for i in range(n):
		p.append(p[i])
	ans = 0
	for i in range(n):
		d = [0, 0]
		for j in range(i, n + i):
			d[0] += p[j][0]
			d[1] += p[j][1]
			dist = d[0] ** 2 + d[1] ** 2
			if ans < dist:
				ans = dist
	print(ans ** 0.5)
	return
F()


import math
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
test_case = []
for i in range(n):
	(x1, y1) = xy[i]
	test_case.append((y1, -x1))
	test_case.append((-y1, x1))
ret = 0
for (x1, y1) in test_case:
	(sx, sy) = (0, 0)
	for j in range(n):
		(x2, y2) = xy[j]
		if x1 * x2 + y1 * y2 > 0 or (x1 * x2 + y1 * y2 == 0 and -y1 * x2 + x1 * y2 >= 0):
			sx += x2
			sy += y2
	ret = max(ret, math.hypot(sx, sy))
print(ret)


import math

def main():
	N = int(input())
	P = [None] * N
	for i in range(N):
		(x, y) = map(int, input().split())
		t = math.atan2(y, x)
		P[i] = (t, x, y)
	P.sort()
	P = P + P
	for i in range(N, 2 * N):
		(t, x, y) = P[i]
		P[i] = (t + math.pi * 2, x, y)
	ans = 0
	for i in range(0, N):
		(X, Y) = (0, 0)
		for j in range(i, N + i):
			(_, x, y) = P[j]
			X += x
			Y += y
			tmp = math.sqrt(X ** 2 + Y ** 2)
			ans = max(tmp, ans)
	print(ans)
main()


from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, atan2
from operator import mul
from functools import reduce
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 20

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def I():
	return int(sys.stdin.buffer.readline())

def LS():
	return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

def S():
	return sys.stdin.buffer.readline().rstrip().decode('utf-8')

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]

def SRL(n):
	return [list(S()) for i in range(n)]

def MSRL(n):
	return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7
n = I()
xy = []
for (x, y) in LIR(n):
	xy += [(atan2(y, x), x, y)]
xy.sort()
xy += xy
cs = [(0, 0)]
for (_, x, y) in xy:
	cs += [(cs[-1][0] + x, cs[-1][1] + y)]
ans = 0
for i in range(n):
	for j in range(i + 1, i + n + 1):
		(x1, x2) = (cs[i][0], cs[j][0])
		(y1, y2) = (cs[i][1], cs[j][1])
		ans = max(ans, (x2 - x1) ** 2 + (y2 - y1) ** 2)
print(ans ** 0.5)


import cmath
n = int(input())
l = [None for i in range(n)]
for i in range(n):
	(a, b) = map(int, input().split())
	c = complex(a, b)
	l[i] = [cmath.phase(c), c]
l.sort(key=lambda x: x[0])
res = 0
for i in range(n):
	c = l[i][1]
	for j in range(1, n):
		cc = c + l[(i + j) % n][1]
		if abs(cc) < abs(c):
			break
		c = cc
	res = max(res, abs(c))
print(res)


import math
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for x in range(-20, 21):
	for y in range(-20, 21):
		sx = 0
		sy = 0
		for v in a:
			if v[0] * x + v[1] * y > 0:
				sx += v[0]
				sy += v[1]
		ans = max(ans, math.sqrt(sx * sx + sy * sy))
print(ans)


import numpy as np
N = int(input())
X = []
Y = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
X = np.array(X)
Y = np.array(Y)
theta = np.arctan2(X, Y)
index = theta.argsort()
X = X[index]
Y = Y[index]
X = np.tile(X, 2)
Y = np.tile(Y, 2)
Xcum = X.cumsum()
Ycum = Y.cumsum()
ans = (Ycum - Ycum[:, None]) ** 2 + (Xcum - Xcum[:, None]) ** 2
m = 0
for i in range(N * 2):
	m = max(m, ans[i, i:i + N + 1].max())
print(m ** 0.5)


import numpy as np
N = int(input())
XY = np.array([list(map(int, input().split())) for _ in [0] * N])
th = np.arctan2(XY[:, 1], XY[:, 0])
XY = XY[th.argsort()]
ans = 0
n = np.linalg.norm
Sxy = np.vstack((np.zeros(2), np.cumsum(XY, axis=0)))
i = 0
j = 1
pr = 0
while i < N:
	r = n(Sxy[min(j, N)] - Sxy[i] + Sxy[max(0, j - N)])
	if r >= pr and j < i + N + 1:
		j += 1
	else:
		i += 1
		j = max(j - 1, i + 1)
		r = 0
	ans = max(ans, r)
	pr = r
print(ans)


import itertools
N = int(input())
XY = [[int(_) for _ in input().split()] for _ in range(N)]
xy1 = []
xy2 = []
xy3 = []
xy4 = []
for (x, y) in XY:
	if x >= 0:
		if y >= 0:
			xy1 += [[x, y]]
		else:
			xy4 += [[x, y]]
	elif y >= 0:
		xy2 += [[x, y]]
	else:
		xy3 += [[x, y]]
xy1.sort(key=lambda xy: float('inf') if xy[0] == 0 else xy[1] / xy[0])
xy2.sort(key=lambda xy: xy[1] / xy[0])
xy3.sort(key=lambda xy: xy[1] / xy[0])
xy4.sort(key=lambda xy: -float('inf') if xy[0] == 0 else xy[1] / xy[0])
XY = xy1 + xy2 + xy3 + xy4
N = len(XY)
XY *= 2
acc = list(itertools.accumulate(XY, func=lambda a, b: [a[0] + b[0], a[1] + b[1]]))
ans = 0
for i in range(N):
	for j in range(i + 1, i + N + 1):
		x = acc[j][0] - acc[i][0]
		y = acc[j][1] - acc[i][1]
		ans = max(ans, x ** 2 + y ** 2)
print(ans ** 0.5)


from itertools import combinations
from cmath import phase
N = int(input())
XY = [complex(*list(map(int, input().split()))) for _ in range(N)]
XY.sort(key=phase)
XY += XY
print(max((abs(sum(XY[i:j])) for (i, j) in combinations(list(range(N * 2 + 1)), 2) if j - i <= N)))


import sys
from math import *
sys.setrecursionlimit(10 ** 6)

def main():
	n = int(input())
	en = []
	n0 = n
	for _ in range(n0):
		(x, y) = map(int, input().split())
		if (x, y) == (0, 0):
			n -= 1
			continue
		en.append([atan2(y, x), x, y])
	en.sort()
	ans = 0
	for l in range(n):
		sx = sy = 0
		arg_l = en[l][0]
		r = l
		for _ in range(n):
			if (en[r][0] - arg_l) % (2 * pi) > pi:
				break
			sx += en[r][1]
			sy += en[r][2]
			ans = max(ans, sx ** 2 + sy ** 2)
			r = (r + 1) % n
	print(ans ** 0.5)
main()


from math import *
N = int(input())
xy = [tuple(map(int, input().split())) for _ in range(N)]
xy.sort(key=lambda t: atan2(t[1], t[0]))
ans = 0
for i in range(N):
	(nx, ny) = (0, 0)
	for j in range(i, i + N):
		nx += xy[j % N][0]
		ny += xy[j % N][1]
		ans = max(ans, (nx ** 2 + ny ** 2) ** 0.5)
print(ans)


import sys
from operator import itemgetter
import math
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

def main():
	N = int(input())
	XY = [[int(x) for x in input().split()] for _ in range(N)]
	ans = 0
	tmp = [0, 0]
	for (x, y) in XY:
		if x > 0:
			tmp[0] += x
			tmp[1] += y
		elif x == 0 and y > 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	tmp = [0, 0]
	for (x, y) in XY:
		if x > 0:
			tmp[0] += x
			tmp[1] += y
		elif x == 0 and y < 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	tmp = [0, 0]
	for (x, y) in XY:
		if x < 0:
			tmp[0] += x
			tmp[1] += y
		elif x == 0 and y > 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	tmp = [0, 0]
	for (x, y) in XY:
		if x < 0:
			tmp[0] += x
			tmp[1] += y
		elif x == 0 and y < 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	tmp = [0, 0]
	for (x, y) in XY:
		if y > 0:
			tmp[0] += x
			tmp[1] += y
		elif y == 0 and x > 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	tmp = [0, 0]
	for (x, y) in XY:
		if y < 0:
			tmp[0] += x
			tmp[1] += y
		elif y == 0 and x > 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	tmp = [0, 0]
	for (x, y) in XY:
		if y > 0:
			tmp[0] += x
			tmp[1] += y
		elif y == 0 and x < 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	tmp = [0, 0]
	for (x, y) in XY:
		if y < 0:
			tmp[0] += x
			tmp[1] += y
		elif y == 0 and x < 0:
			tmp[0] += x
			tmp[1] += y
	ans = max(ans, math.sqrt(tmp[0] ** 2 + tmp[1] ** 2))
	for (i, (x, y)) in enumerate(XY):
		if x == 0:
			katamuki = 0
			katamuki2 = float('inf')
		else:
			katamuki = y / x
			if y == 0:
				katamuki2 = float('inf')
			else:
				katamuki2 = -(x / y)
		plus = [0, 0]
		minus = [0, 0]
		plus2 = [0, 0]
		minus2 = [0, 0]
		for (j, (xx, yy)) in enumerate(XY):
			if i == j:
				continue
			if yy > katamuki * xx:
				plus[0] += xx
				plus[1] += yy
			else:
				minus[0] += xx
				minus[1] += yy
			if katamuki2 == float('inf'):
				if xx > 0:
					plus2[0] += xx
					plus2[1] += yy
				else:
					minus2[0] += xx
					minus2[1] += yy
			elif yy > katamuki2 * xx:
				plus2[0] += xx
				plus2[1] += yy
			else:
				minus2[0] += xx
				minus2[1] += yy
		ans = max(ans, math.sqrt(plus[0] ** 2 + plus[1] ** 2))
		ans = max(ans, math.sqrt(minus[0] ** 2 + minus[1] ** 2))
		ans = max(ans, math.sqrt(plus2[0] ** 2 + plus2[1] ** 2))
		ans = max(ans, math.sqrt(minus2[0] ** 2 + minus2[1] ** 2))
		ans = max(ans, math.sqrt((plus[0] + x) ** 2 + (plus[1] + y) ** 2))
		ans = max(ans, math.sqrt((minus[0] + x) ** 2 + (minus[1] + y) ** 2))
		ans = max(ans, math.sqrt((plus2[0] + x) ** 2 + (plus2[1] + y) ** 2))
		ans = max(ans, math.sqrt((minus2[0] + x) ** 2 + (minus2[1] + y) ** 2))
	print(ans)

def __starting_point():
	main()
__starting_point()


from collections import defaultdict, deque, Counter
import sys
import heapq
import math
sys.setrecursionlimit(1000000000)
MIN = -10 ** 9
MOD = 10 ** 9 + 7

def norm(theta):
	if theta > math.pi:
		return theta - 2 * math.pi
	if theta < -math.pi:
		return theta + 2 * math.pi

def solve(state, xy):
	(xx, yy) = (0, 0)
	for i in state:
		(x, y) = xy[i]
		xx += x
		yy += y
	return math.sqrt(xx * xx + yy * yy)

def main():
	N = int(input())
	xy = [[int(a) for a in input().split()] for _ in range(N)]
	ttt = []
	ts = []
	for (i, (x, y)) in enumerate(xy):
		theta = math.atan2(y, x)
		m1 = theta - math.pi / 2
		m2 = theta + math.pi / 2
		b = [(m1, m2)]
		if m1 < -math.pi:
			b = [(-math.pi, m2), (m1 + 2 * math.pi, math.pi)]
		elif m2 > math.pi:
			b = [(-math.pi, m2 - 2 * math.pi), (m1, math.pi)]
		ts.append(b)
		for (xx, yy) in b:
			ttt.append((xx, i, 'enter'))
			ttt.append((yy, i, 'leave'))
	result = 0
	state = set()
	for (p, i, typ) in sorted(ttt, key=lambda a: a[0]):
		if typ == 'enter':
			state.add(i)
		else:
			state.remove(i)
		score = solve(state, xy)
		result = max(result, score)
	print(result)
main()


import sys
input = sys.stdin.readline

class Vec:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __str__(self):
		return '({}, {})'.format(self.x, self.y)

	def __add__(self, other):
		return Vec(self.x + other.x, self.y + other.y)

	def __sub__(self, other):
		return Vec(self.x - other.x, self.y - other.y)

	def __mul__(self, k):
		return Vec(self.x * k, self.y * k)

	def __truediv__(self, k):
		return Vec(self.x / k, self.y / k)

	def abs(self):
		return (self.x ** 2 + self.y ** 2) ** 0.5

	def dot(self, other):
		return self.x * other.x + self.y * other.y

	def cross(self, other):
		return self.x * other.y - self.y * other.x

	def rot(self, ang):
		c = math.cos(ang)
		s = math.sin(ang)
		return Vec(c * self.x - s * self.y, s * self.x + c * self.y)

def convex_hull(points, eps=1e-12):
	n = len(points)
	points.sort(key=lambda p: (p.x, p.y))
	k = 0
	ch = [None] * (2 * n)
	for i in range(n):
		while k > 1 and (ch[k - 1] - ch[k - 2]).cross(points[i] - ch[k - 1]) < eps:
			k -= 1
		ch[k] = points[i]
		k += 1
	t = k
	for i in range(0, n - 1)[::-1]:
		while k > t and (ch[k - 1] - ch[k - 2]).cross(points[i] - ch[k - 1]) < eps:
			k -= 1
		ch[k] = points[i]
		k += 1
	return ch[:k - 1]
N = int(input())
xy = [Vec(*tuple(map(int, input().split()))) for _ in range(N)]
points = [Vec(0, 0)]
for v in xy:
	npoints = points[:]
	for u in points:
		npoints.append(u + v)
	points = convex_hull(npoints)
ans = max((v.abs() for v in points))
print(ans)


import math

def arg(x, y):
	if x == 0:
		if y > 0:
			return math.pi / 2
		else:
			return 3 * math.pi / 2
	elif x > 0:
		return math.atan(y / x)
	else:
		return math.atan(y / x) + math.pi
n = int(input())
A = []
for i in range(n):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		continue
	A.append([arg(x, y), x, y])
	A.append([arg(x, y) + 2 * math.pi, x, y])
A = sorted(A)
n = len(A) // 2
ans = 0
for i in range(n):
	for j in range(1, n + 1):
		X = 0
		Y = 0
		for k in range(i, i + j):
			X = X + A[k][1]
			Y = Y + A[k][2]
		d = (X ** 2 + Y ** 2) ** (1 / 2)
		if d > ans:
			ans = d
print(ans)


from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
mod = 10 ** 9 + 7
eps = 10 ** (-7)

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_str():
	return list(sys.stdin.readline().split())
N = inp()
points = []
for _ in range(N):
	(x, y) = inpl()
	t = math.atan2(y, x)
	points.append((t, x, y))
points.sort()
ans = 0
for (s, [theta, x, y]) in enumerate(points):
	tmpx = tmpy = 0
	for t in range(s, s + N):
		(_, tx, ty) = points[t % N]
		tmpx += tx
		tmpy += ty
		ans = max(ans, tmpx ** 2 + tmpy ** 2)
print(math.sqrt(ans))


def get_convex_hull(points):

	def det(p, q):
		return (p.conjugate() * q).imag
	points.sort(key=lambda x: (x.real, x.imag))
	ch = []
	for p in points:
		while len(ch) > 1:
			v_cur = ch[-1] - ch[-2]
			v_new = p - ch[-2]
			if det(v_cur, v_new) > 0:
				break
			ch.pop()
		ch.append(p)
	t = len(ch)
	for p in points[-2::-1]:
		while len(ch) > t:
			v_cur = ch[-1] - ch[-2]
			v_new = p - ch[-2]
			if det(v_cur, v_new) > 0:
				break
			ch.pop()
		ch.append(p)
	return ch[:-1]
N = int(input())
XY = [complex(*list(map(int, input().split()))) for _ in range(N)]
ps = [complex(0, 0)]
for p in XY:
	ps_new = ps[:]
	for p_ in ps:
		ps_new.append(p + p_)
	ps = get_convex_hull(ps_new)
ans = 0
for p in ps:
	ans = max(ans, abs(p))
print(ans)


import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)

def geta(fn=lambda s: s.decode()):
	return map(fn, readline().split())

def gete(fn=lambda s: s.decode()):
	return fn(readline().rstrip())
import math

def arg(x, y):
	c = x / math.sqrt(x * x + y * y)
	t = math.acos(c)
	if y < 0:
		t = 2 * math.pi - t
	return t

def dist2(x, y):
	return x * x + y * y

def main():
	N = gete(int)
	E = []
	for _ in range(N):
		(x, y) = geta(int)
		if x != 0 or y != 0:
			E.append((arg(x, y), x, y))
	E.sort()
	N = len(E)
	ans2 = 0
	for i in range(N):
		j = i
		(px, py) = (0, 0)
		(_, qx, qy) = E[i]
		c = 0
		while c < N and dist2(px, py) <= dist2(qx, qy):
			j += 1
			c += 1
			(px, py) = (qx, qy)
			(_, ex, ey) = E[j % N]
			(qx, qy) = (px + ex, py + ey)
		tmp = dist2(px, py)
		if ans2 < tmp:
			ans2 = tmp
	print(math.sqrt(ans2))
	ans = 0
main()


N = int(input())
S1 = []
S2 = []
S3 = []
S4 = []
YP = []
YM = []
for i in range(N):
	(x, y) = map(int, input().split())
	if x == 0:
		if y >= 0:
			YP.append([0, x, y])
		else:
			YM.append([0, x, y])
	elif x > 0 and y >= 0:
		S1.append([y / x, x, y])
	elif x > 0 and y < 0:
		S2.append([y / x, x, y])
	elif x < 0 and y < 0:
		S3.append([y / x, x, y])
	else:
		S4.append([y / x, x, y])
S1.sort(reverse=True)
S2.sort(reverse=True)
S3.sort(reverse=True)
S4.sort(reverse=True)
L = YP + S1 + S2 + YM + S3 + S4
List = L + L
ans = 0
for i in range(len(L)):
	X = List[i][1]
	Y = List[i][2]
	cnt = X * X + Y * Y
	if ans < cnt:
		ans = cnt
	for j in range(1, len(L)):
		X += List[i + j][1]
		Y += List[i + j][2]
		cnt = X * X + Y * Y
		if ans < cnt:
			ans = cnt
print(ans ** 0.5)


import math
n = int(input())
ans = 0
l = [tuple(map(int, input().split())) for _ in range(n)]
for i in range(1001):
	th = 2 * i * math.pi / 1000
	thx = math.cos(th)
	thy = math.sin(th)
	(cx, cy) = (0, 0)
	for (dx, dy) in l:
		if thx * dx + thy * dy > 0:
			cx += dx
			cy += dy
	ans = max(ans, cx ** 2 + cy ** 2)
print(ans ** 0.5)


import sys
from math import atan2, pi
n = int(input())
angles = []
engines = []
pi2 = 2 * pi
for (i, line) in enumerate(sys.stdin):
	(x, y) = list(map(int, line.split()))
	angle = atan2(y, x)
	angles.append((angle, i))
	angles.append((angle + pi2, i))
	engines.append(x + y * 1j)
angles.sort()
r = 0
tmp = 0
total = sum(engines)
ans = 0
for l in range(n):
	(angle, i) = angles[l]
	limit = angle + pi
	while angles[r][0] < limit:
		tmp += engines[angles[r][1]]
		r += 1
	ans = max(ans, abs(tmp), abs(total - tmp))
	tmp -= engines[i]
print(ans)


from math import atan2

def dist(x, y):
	return (x ** 2 + y ** 2) ** (1 / 2)
n = int(input())
data = []
for i in range(n):
	(x, y) = map(int, input().split())
	data.append([atan2(y, x), x, y])
data.sort()
data = data + data
ans = 0
for i in range(n):
	for j in range(i + 1, n + i + 1):
		(x, y) = (0, 0)
		for k in range(i, j):
			x += data[k][1]
			y += data[k][2]
		ans = max(ans, dist(x, y))
print(ans)


n = int(input())
xy1 = []
xy2 = []
for i in range(n):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		continue
	cos = x / (x ** 2 + y ** 2) ** 0.5
	sin = y / (x ** 2 + y ** 2) ** 0.5
	if sin >= 0:
		xy1.append([x, y, cos])
	else:
		xy2.append([x, y, cos])
xy1.sort(key=lambda x: x[2], reverse=True)
xy2.sort(key=lambda x: x[2])
xy = xy1 + xy2
xy = xy + xy
max_vector = 0
for i in range(len(xy) // 2):
	for j in range(i, i + len(xy) // 2):
		(x, y) = (0, 0)
		for k in range(i, j + 1):
			x += xy[k][0]
			y += xy[k][1]
		max_vector = max(max_vector, (x ** 2 + y ** 2) ** 0.5)
print(max_vector)


import math
n = int(input())
X = [list(map(int, input().split())) for i in range(n)]
X2 = []
for i in range(n):
	if X[i] != [0, 0]:
		X2.append(X[i][:])
X = X2[:]
n = len(X)
if n == 0:
	print(0)
else:
	for i in range(n):
		X[i].append(math.atan2(X[i][1], X[i][0]))
	X.sort(key=lambda x: x[2])
	X += X[:]
	ans = 0
	X_sum = [[X[0][0], X[0][1]]]
	for i in range(1, 2 * n):
		X_sum.append([X_sum[i - 1][0] + X[i][0], X_sum[i - 1][1] + X[i][1]])
	for st in range(0, n):
		for en in range(st + 1, st + n + 1):
			dis = [0, 0]
			for i in range(st, en):
				dis[0] = X_sum[en][0] - X_sum[st][0]
				dis[1] = X_sum[en][1] - X_sum[st][1]
			ans = max(ans, dis[0] ** 2 + dis[1] ** 2)
	print(ans ** 0.5)


import math
pi = math.atan(1) * 4
N = int(input())
X = []
for _ in range(N):
	(x, y) = map(int, input().split())
	if x == y == 0:
		continue
	if x == 0:
		r = pi / 2 if y > 0 else -pi / 2
	else:
		r = math.atan(y / x)
		if x < 0:
			r += pi
	X.append((x, y, r))
X = sorted(X, key=lambda x: x[2]) * 2
M = len(X)
ma = 0
for i in range(M):
	(sx, sy) = (0, 0)
	for j in range(i + 1, min(i + M // 2 + 1, M)):
		sx += X[j][0]
		sy += X[j][1]
		d = sx ** 2 + sy ** 2
		ma = max(ma, d)
print(ma ** 0.5)


import sys
import math
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
n = ni()
co = []
for i in range(n):
	t = na()
	if t[0] == 0 and t[1] == 0:
		continue
	co.append(t)
n = len(co)
if n == 0:
	print(0)
	sys.exit(0)
co.sort(key=lambda x: math.atan2(x[1], x[0]))
ans = 0
co = co + co
for i in range(n):
	(vx, vy) = (0, 0)
	for j in range(i, i + n):
		vx += co[j][0]
		vy += co[j][1]
		ans = max(ans, vx * vx + vy * vy)
print('{:.14f}'.format(math.sqrt(ans)))


import math
from operator import itemgetter
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
	tmp = math.atan2(info[i][1], info[i][0])
	info[i].append(tmp)
info = sorted(info, key=itemgetter(2))
info = info + info
ans = 0
for i in range(n):
	tmp = [0, 0]
	for j in range(n):
		tmp[0] += info[i + j][0]
		tmp[1] += info[i + j][1]
		tmp_ans = tmp[0] ** 2 + tmp[1] ** 2
		ans = max(tmp_ans, ans)
print(ans ** 0.5)


from math import atan2, pi, sqrt
n = int(input())
p = []
xa = ya = 0
for i in range(n):
	(x, y) = map(int, input().split())
	angle = atan2(y, x)
	p.append((x, y, angle))
	p.append((x, y, angle + 2 * pi))
	xa += x
	ya += y
p.sort(key=lambda x: x[2])
r = 0
ans = 0
xs = ys = 0
for l in range(n):
	while p[r][2] < p[l][2] + pi:
		xs += p[r][0]
		ys += p[r][1]
		r += 1
	ans = max(ans, sqrt(xs ** 2 + ys ** 2), sqrt((xa - xs) ** 2 + (ya - ys) ** 2))
	xs -= p[l][0]
	ys -= p[l][1]
print(ans)


N = int(input())
from cmath import phase
XY = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: phase(x[0] + x[1] * 1j))
XY += XY
ans = 0
for l in range(N):
	a = [0, 0]
	for r in range(l, min(2 * N, l + N)):
		a[0] += XY[r][0]
		a[1] += XY[r][1]
		ans = max(ans, abs(a[0] + a[1] * 1j))
print(ans)


n = int(input())
xp = []
xm = []
yp = []
ym = []
for _ in range(n):
	(x, y) = map(int, input().split())
	if x == 0:
		if y == 0:
			n -= 1
		elif y > 0:
			yp.append([0, x, y])
		else:
			ym.append([0, x, y])
	elif x > 0:
		xp.append([y / x, x, y])
	else:
		xm.append([y / x, x, y])
xp.sort()
xm.sort()
xy = xp + yp + xm + ym
can = []
for i in range(-n, 0):
	X = 0
	Y = 0
	for j in range(i + 1, i + n + 1):
		(x, y) = (xy[j][1], xy[j][2])
		X += x
		Y += y
		can.append(X ** 2 + Y ** 2)
if n == 0:
	print(0)
else:
	print(max(can) ** 0.5)


N = int(input())
v_list = []
for _ in range(N):
	v_list.append(tuple(map(int, input().strip().split())))
import math
v_list2 = []
for (x, y) in v_list:
	r = math.atan2(x, y)
	v_list2.append((r, x, y))
v_list2.sort()
max_dist = 0
for i in range(N):
	for w in range(1, N + 1):
		x = 0
		y = 0
		for j in range(w):
			(r, dx, dy) = v_list2[(i + j) % N]
			x += dx
			y += dy
		dist = x * x + y * y
		if dist > max_dist:
			max_dist = dist
print(math.sqrt(max_dist))


import math
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
xy2 = []
for (x, y) in xy:
	if x == y == 0:
		continue
	xy2.append((x, y))
n = len(xy2)
if n == 0:
	print(0)
	exit()
degs = [0]
for (x, y) in xy2:
	deg = math.atan2(y, x)
	deg1 = (deg + math.pi * 0.5) % (2 * math.pi)
	deg2 = (deg + math.pi * 1.5) % (2 * math.pi)
	degs.append(deg1)
	degs.append(deg2)
degs.append(2 * math.pi)
degs.sort()
ans = 0
for i in range(len(degs) - 1):
	deg = (degs[i + 1] + degs[i]) / 2
	sum_x = 0
	sum_y = 0
	for (x, y) in xy2:
		tmp = x * math.cos(deg) + y * math.sin(deg)
		if tmp > 0:
			sum_x += x
			sum_y += y
		ans = max(ans, (sum_x ** 2 + sum_y ** 2) ** 0.5)
print(ans)


import math
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
	XY[i].append(math.atan2(XY[i][1], XY[i][0]))
XY.sort(key=lambda x: x[2])
ans = 0
tmp = [0, 0]
ruisekiwa_x = [0] * N
ruisekiwa_y = [0] * N
ruisekiwa_x[0] = XY[0][0]
ruisekiwa_y[0] = XY[0][1]
for i in range(1, N):
	ruisekiwa_x[i] = ruisekiwa_x[i - 1] + XY[i][0]
	ruisekiwa_y[i] = ruisekiwa_y[i - 1] + XY[i][1]
ans = 0
for i in range(N):
	for j in range(i, N):
		if i > 0:
			tmp[0] = ruisekiwa_x[j] - ruisekiwa_x[i - 1]
			tmp[1] = ruisekiwa_y[j] - ruisekiwa_y[i - 1]
		else:
			tmp[0] = ruisekiwa_x[j]
			tmp[1] = ruisekiwa_y[j]
		ans = max(ans, math.sqrt(tmp[0] * tmp[0] + tmp[1] * tmp[1]))
for i in range(N):
	if XY[i][2] < 0:
		XY[i][2] = -math.pi - XY[i][2]
	else:
		XY[i][2] = math.pi - XY[i][2]
XY.sort(key=lambda x: x[2])
ruisekiwa_x = [0] * N
ruisekiwa_y = [0] * N
ruisekiwa_x[0] = XY[0][0]
ruisekiwa_y[0] = XY[0][1]
for i in range(1, N):
	ruisekiwa_x[i] = ruisekiwa_x[i - 1] + XY[i][0]
	ruisekiwa_y[i] = ruisekiwa_y[i - 1] + XY[i][1]
for i in range(N):
	for j in range(i, N):
		if i > 0:
			tmp[0] = ruisekiwa_x[j] - ruisekiwa_x[i - 1]
			tmp[1] = ruisekiwa_y[j] - ruisekiwa_y[i - 1]
		else:
			tmp[0] = ruisekiwa_x[j]
			tmp[1] = ruisekiwa_y[j]
		ans = max(ans, math.sqrt(tmp[0] * tmp[0] + tmp[1] * tmp[1]))
print(ans)


import math
N = int(input())
A = []
for j in range(N):
	A.append([int(i) for i in input().split()])
for engine in A:
	engine.append(math.degrees(math.atan2(engine[1], engine[0])))
if len(A) == 1:
	print(math.sqrt(A[0][0] ** 2 + A[0][1] ** 2))
	exit()
A.sort(key=lambda x: x[2])
A = A + A
mx = 0
for i in range(N):
	X = A[i][0]
	Y = A[i][1]
	temp = 0
	for j in range(i + 1, i + N):
		if math.sqrt(X ** 2 + Y ** 2) > mx:
			mx = math.sqrt(X ** 2 + Y ** 2)
		X = X + A[j][0]
		Y = Y + A[j][1]
		if temp > math.sqrt(X ** 2 + Y ** 2):
			break
		temp = math.sqrt(X ** 2 + Y ** 2)
		if math.sqrt(X ** 2 + Y ** 2) > mx:
			mx = math.sqrt(X ** 2 + Y ** 2)
print(mx)


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
D = []
import math
for i in range(N):
	(x, y) = xy[i]
	t = math.atan2(y, x)
	t = math.degrees(t)
	if t < 0:
		t += 360
	D.append([t, x, y])
import copy
D.sort()
D = D + copy.deepcopy(D)
for i in range(N, N + N):
	D[i][0] += 360
ans = 0
for i in range(N):
	(x, y) = (0, 0)
	d = D[i][0]
	for j in range(i, i + N):
		t = D[j][0]
		if t - d > 180:
			break
		x += D[j][1]
		y += D[j][2]
		l = (x ** 2 + y ** 2) ** (1 / 2)
		ans = max(ans, l)
print(ans)


from math import atan2, pi
n = int(input())
e = []
for _ in range(n):
	(x, y) = map(int, input().split())
	r = atan2(y, x)
	if r < 0:
		r += pi * 2
	e.append([r, x, y])
e.sort()
ans = 0
for i in range(n):
	e.append([e[i][0] + pi * 2, e[i][1], e[i][2]])
	ans = max(ans, (e[i][1] ** 2 + e[i][2] ** 2) ** 0.5)
if n == 1:
	print(ans)
	exit()
for L in range(n):
	x = e[L][1]
	y = e[L][2]
	for R in range(L + 1, L + n):
		x += e[R][1]
		y += e[R][2]
		ans = max(ans, (x ** 2 + y ** 2) ** 0.5)
print(ans)


import math
import cmath
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
atan = math.atan2
deg = math.degrees
eps = 1e-09
N = int(input())
arg = []
XY = []
for i in range(N):
	(x, y) = map(int, input().split())
	arg.append((deg(atan(y, x)), x, y))
arg.sort()
arg += [(th + 360, x, y) for (th, x, y) in arg]
dth = 360 / 5000
th = 0
ans = 0
for _ in range(5001):
	X = 0
	Y = 0
	for (a, x, y) in arg:
		if abs(th - a) < 90 + eps:
			X += x
			Y += y
	ans = max(ans, X ** 2 + Y ** 2)
	th += dth
print('{:.40f}'.format(ans ** 0.5))


import cmath
import itertools
n = int(input())
C = sorted([complex(*map(int, input().split())) for _ in range(n)], key=cmath.phase)
score = 0
for (i, j) in itertools.product(range(n), range(n)):
	if i > j:
		continue
	score = max((score, abs(sum(C[:i] + C[j:])), abs(sum(C[i:j]))))
print(score)


import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10 ** 9))
write = lambda x: sys.stdout.write(x + '\n')
n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]

def sub(x, y):
	xx = 0
	yy = 0
	for (tx, ty) in xy:
		if x * tx + y * ty > 0:
			xx += tx
			yy += ty
	return (xx * xx + yy * yy) ** 0.5
ans = -1
for (i, (x, y)) in enumerate(xy):
	for (x2, y2) in xy:
		ans = max(ans, sub((x + x2) / 2, (y + y2) / 2))
print(ans)


import math
N = int(input())
x = [0 for i in range(N)]
y = [0 for i in range(N)]
for i in range(N):
	(x[i], y[i]) = map(int, input().split())
M = 10000
ans = 0
for i in range(M):
	Vx = math.cos(2 * i * math.pi / M)
	Vy = math.sin(2 * i * math.pi / M)
	X = 0
	Y = 0
	for j in range(N):
		if Vx * x[j] + Vy * y[j] >= 0:
			X += x[j]
			Y += y[j]
	ans = max(ans, X * X + Y * Y)
print(math.sqrt(ans))


from functools import cmp_to_key

def argsort(arr):

	def cmp(p1, p2):
		(x1, y1) = p1
		(x2, y2) = p2
		if x1 >= y1 == 0:
			if y2 > 0:
				return -1
			if y2 < 0:
				return 1
			if x2 < 0:
				return -1
			return 0
		if x2 >= y2 == 0:
			if y1 > 0:
				return 1
			if y1 < 0:
				return -1
			if x1 < 0:
				return 1
			return 0
		if y1 == 0:
			return 1
		if y2 == 0:
			return -1
		if y1 > 0 and y2 < 0:
			return 1
		if y2 > 0 and y1 < 0:
			return -1
		if x1 * y2 > x2 * y1:
			return -1
		if x1 * y2 < x2 * y1:
			return 1
		return 0
	return sorted(arr, key=cmp_to_key(cmp))

def dist(x, y):
	return (x ** 2 + y ** 2) ** 0.5
N = int(input())
P = [tuple(map(int, input().split())) for _ in range(N)]
P = argsort(P)
C = [(0, 0)]
for i in range(N):
	C.append((C[-1][0] + P[i][0], C[-1][1] + P[i][1]))
res = 0
for i in range(N):
	for lt in range(N):
		for rt in range(N):
			if lt <= i <= rt:
				x = C[rt + 1][0] - C[lt][0]
				y = C[rt + 1][1] - C[lt][1]
			elif i <= rt < lt or rt < lt <= i:
				x = C[rt + 1][0] + C[N][0] - C[lt][0]
				y = C[rt + 1][1] + C[N][1] - C[lt][1]
			else:
				continue
			res = max(res, dist(x, y))
print(res)


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
from math import atan2
pts = []
for (x, y) in xy:
	if x == 0 and y == 0:
		continue
	else:
		pts.append((atan2(y, x), x, y))
pts.sort()
cum_xy = [(0, 0)]
for (a, x, y) in pts:
	(pv_x, pv_y) = cum_xy[-1]
	cum_xy.append((pv_x + x, pv_y + y))
ans2 = 0
for i in range(len(cum_xy)):
	for j in range(i, len(cum_xy)):
		length = (cum_xy[j][0] - cum_xy[i][0]) ** 2 + (cum_xy[j][1] - cum_xy[i][1]) ** 2
		if length > ans2:
			ans2 = length
		length = (cum_xy[j][0] - cum_xy[i][0] - cum_xy[-1][0]) ** 2 + (cum_xy[j][1] - cum_xy[i][1] - cum_xy[-1][1]) ** 2
		if length > ans2:
			ans2 = length
print(ans2 ** 0.5)


import sys
sys.setrecursionlimit(10 ** 7)

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def II():
	return int(sys.stdin.readline())

def SI():
	return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7
import math

def main():
	N = II()
	engines = []
	for _ in range(N):
		(x, y) = LI()
		angle = math.atan2(y, x)
		engines.append((x, y, angle))
	engines.sort(key=lambda x: x[2])
	dist_max = 0
	cnt = -1
	for (x1, y1, angle1) in engines:
		cnt += 1
		if angle1 <= 0:
			search_criteria = lambda x: True if angle1 <= x < angle1 + math.pi else False
		else:
			search_criteria = lambda x: True if angle1 <= x or x < angle1 - math.pi else False
		x_sum = 0
		y_sum = 0
		for (x, y, angle) in engines[cnt:] + engines[:cnt]:
			if search_criteria(angle):
				x_sum += x
				y_sum += y
			dist_max = max(dist_max, math.sqrt(x_sum ** 2 + y_sum ** 2))
	print(dist_max)
main()


from math import sin, cos, pi
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for n in range(10 ** 5):
	Rx = cos(2 * pi * n / 10 ** 5)
	Ry = sin(2 * pi * n / 10 ** 5)
	X = 0
	Y = 0
	for (x, y) in xy:
		if Rx * x + Ry * y > 0:
			X += x
			Y += y
	ans = max(ans, (X ** 2 + Y ** 2) ** 0.5)
print(ans)


import math
N = int(input())
data = []
p = math.pi
e = 10 ** (-9)
for i in range(N):
	(x, y) = map(int, input().split())
	data.append([math.atan2(y, x), x, y])
	data.append([math.atan2(y, x) + 2 * p, x, y])
data.sort()
ans = 0
for left in range(N):
	x_sum = 0
	y_sum = 0
	right = left
	while data[right][0] - data[left][0] <= p - e:
		x_sum += data[right][1]
		y_sum += data[right][2]
		ans = max(ans, x_sum ** 2 + y_sum ** 2)
		right += 1
print(ans ** 0.5)


import cmath
import math
N = int(input())
Engines = []
ans = 0
(sumx, sumy) = (0, 0)
for _ in range(N):
	(x, y) = map(int, input().split())
	z = complex(x, y)
	arg_deg = cmath.phase(z)
	sumx += x
	sumy += y
	Engines.append((arg_deg, x, y))
ans = max(ans, math.hypot(sumx, sumy))
Engines.sort()
for i in range(N):
	for j in range(i, N):
		sub_x = 0
		sub_y = 0
		for k in range(i, j + 1):
			(deg, dx, dy) = Engines[k]
			sub_x += dx
			sub_y += dy
		ans = max(ans, math.hypot(sub_x, sub_y))
		ans = max(ans, math.hypot(sumx - sub_x, sumy - sub_y))
print(ans)


from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
import math
sys.setrecursionlimit(10 ** 6)

def SI():
	return input().split()

def MI():
	return map(int, input().split())

def I():
	return int(input())

def LI():
	return [int(i) for i in input().split()]
YN = ['Yes', 'No']
mo = 10 ** 9 + 7
n = I()
e = []
for i in range(n):
	(x, y) = MI()
	if (x, y) == (0, 0):
		continue
	else:
		t = math.atan2(y, x)
		e.append((x, y, t))
e.sort(key=lambda x: x[2])
n = len(e)
e += e
a = [(0, 0)]
ans = 0
for (x, y, t) in e:
	a += [(a[-1][0] + x, a[-1][1] + y)]
for l in range(n * 2):
	for r in range(l, n * 2):
		if r - l > n:
			continue
		else:
			(x, y) = a[r]
			(w, z) = a[l]
			ans = max((x - w) ** 2 + (y - z) ** 2, ans)
print(ans ** 0.5 if n > 0 else 0)


import math
n = int(input())
P = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	rad = math.atan2(x, y)
	P.append([rad, x, y])
P.sort()
P = P + P
x0 = 0
y0 = 0
mx = 0
for i in range(n):
	vx = 0
	vy = 0
	for j in range(n):
		vx += P[i + j][1]
		vy += P[i + j][2]
		v = vx ** 2 + vy ** 2
		mx = max(v, mx)
print(math.sqrt(mx))


from math import hypot, atan2
N = int(input())
XY = [tuple(map(int, input().split())) for i in range(N)]
xy = sorted(XY, key=lambda x: atan2(x[1], x[0]))
xy += xy
ans = 0
for i in range(N):
	sx = sy = 0
	for j in range(N):
		(x, y) = xy[i + j]
		sx += x
		sy += y
		d = hypot(sx, sy)
		if d > ans:
			ans = d
print(ans)


from math import atan2, hypot
n = int(input())
xy = []
for i in range(n):
	(x, y) = map(int, input().split())
	theta = atan2(y, x)
	xy.append((theta, y, x))
xy.sort()
xy += xy
cs = [(0, 0)]
for (_, x, y) in xy:
	cs.append((cs[-1][0] + x, cs[-1][1] + y))
ans = 0
for i in range(n):
	for j in range(i + 1, i + n + 1):
		(x1, y1) = cs[i]
		(x2, y2) = cs[j]
		ans = max(ans, hypot(x1 - x2, y1 - y2))
print(ans)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
import math
n = getN()
r_vectors = []
l_vectors = []
py = []
ny = []
for i in range(n):
	(x, y) = getList()
	if x == 0:
		if y > 0:
			py.append((x, y))
		elif y < 0:
			ny.append((x, y))
		else:
			n -= 1
	elif x > 0:
		r_vectors.append((x, y))
	else:
		l_vectors.append((x, y))
l_vectors.sort(key=lambda v: -v[1] / v[0])
r_vectors.sort(key=lambda v: -v[1] / v[0])
r_vectors = r_vectors + ny
l_vectors = l_vectors + py
vectors = (r_vectors + l_vectors) * 2
ans = 0
for (i, start) in enumerate(vectors[:n]):
	(tx, ty) = (0, 0)
	for j in range(n):
		(x, y) = vectors[i + j]
		tx += x
		ty += y
		tmp = tx ** 2 + ty ** 2
		if ans < tmp:
			ans = tmp
print(math.sqrt(ans))


from math import sqrt
n = int(input())

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y
		return

	def __lt__(self, p2):
		return self.quadrant() < p2.quadrant() or (self.quadrant() == p2.quadrant() and self.x * p2.y - self.y * p2.x > 0)

	def __repr__(self):
		return repr((self.x, self.y))

	def __add__(self, p2):
		return Point(self.x + p2.x, self.y + p2.y)

	def __sub__(self, p2):
		return Point(self.x - p2.x, self.y - p2.y)

	def quadrant(self):
		if self.x > 0 and self.y >= 0:
			return 1
		elif self.y > 0:
			return 2
		elif self.x < 0:
			return 3
		else:
			return 4

	def square(self):
		return self.x ** 2 + self.y ** 2
xy = [Point(xi, yi) for (xi, yi) in (map(int, input().split()) for _ in range(n)) if not xi == yi == 0]
cur_point = sum((p for p in xy if p.y > 0 or (p.y == 0 and p.x >= 0)), Point(0, 0))
inv = list((Point(-p.x, -p.y) for p in xy))
xy.extend(inv)
xy.sort()
mx = cur_point.square()
for p in xy:
	cur_point -= p
	mx = max(mx, cur_point.square())
print(sqrt(mx))


def examF():

	def calc_L(a, b):
		return (a ** 2 + b ** 2) ** (1 / 2)
	N = I()
	X = [[] for _ in range(N)]
	for i in range(N):
		(x, y) = LI()
		d = math.degrees(math.atan2(y, x))
		if d < 0:
			d += 360
		X[i] = [d, x, y]
	X.sort()
	ans = 0
	for i in range(N):
		cur_X = 0
		cur_Y = 0
		for (d2, x2, y2) in X[i:] + X[:i]:
			if calc_L(cur_X + x2, cur_Y + y2) < calc_L(cur_X, cur_Y):
				continue
			cur_X += x2
			cur_Y += y2
		now = calc_L(cur_X, cur_Y)
		if now > ans:
			ans = now
	print(ans)
	return
import sys, copy, bisect, itertools, heapq, math, random
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
sys.setrecursionlimit(10 ** 6)
examF()


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
import math
xy.sort(key=lambda x: math.atan2(x[1], x[0]))
atanxy = [math.atan2(yi, xi) for (xi, yi) in xy]
ans2 = 0
for src in range(N):
	(x_tmp, y_tmp) = xy[src]
	if ans2 < x_tmp ** 2 + y_tmp ** 2:
		ans2 = x_tmp ** 2 + y_tmp ** 2
	for j in range(1, N):
		dst = (src + j) % N
		x_tmp += xy[dst][0]
		y_tmp += xy[dst][1]
		if ans2 < x_tmp ** 2 + y_tmp ** 2:
			ans2 = x_tmp ** 2 + y_tmp ** 2
print(math.sqrt(ans2))


from math import *
n = int(input())
engine = [list(map(int, input().split())) for i in range(n)]
args = []
for i in range(n):
	(x, y) = engine[i]
	if x == 0:
		if y < 0:
			args.append((-pi / 2, x, y))
		elif y > 0:
			args.append((pi / 2, x, y))
	elif y == 0:
		if x > 0:
			args.append((0, x, y))
		elif x < 0:
			args.append((pi, x, y))
	else:
		args.append((atan2(y, x), x, y))
args.sort()
l = len(args)
args = args[:] + args[:]
ans = 0
for i in range(1, l + 1):
	for j in range(l):
		(x, y) = (0, 0)
		for k in range(j, j + i):
			x += args[k][1]
			y += args[k][2]
		ans = max(ans, hypot(x, y))
print(ans)


import math
n = int(input())
xy = []
for i in range(n):
	(x, y) = [int(item) for item in input().split()]
	if x == 0 and y == 0:
		rad = 0.0
	elif x == 0:
		if y > 0:
			rad = math.pi / 2.0
		elif y < 0:
			rad = -math.pi / 2.0
	else:
		rad = math.atan2(y, x)
	deg = math.degrees(rad)
	xy.append((deg, x, y))
xy.sort()
xy2 = xy[:]
for (i, (d, x, y)) in enumerate(xy):
	xy2.append((d + 360.0, x, y))
	if i == 0:
		xy2.append((d + 720.0, x, y))
xy2.sort()
ans = 0.0
for i in range(n):
	for j in range(i + 1, i + n + 1):
		x = 0.0
		y = 0.0
		for k in range(i, j):
			x += xy2[k][1]
			y += xy2[k][2]
		d = math.hypot(x, y)
		ans = max(ans, d)
print(ans)


import numpy as np
n = int(input())
xy = np.array([list(map(int, input().split())) for _ in range(n)]).T
ans = 0
L = np.angle(xy[0] + xy[1] * 1j)
A = sorted([[j, xy[0][i], xy[1][i]] for (i, j) in enumerate(L)])
A = [i[1:] for i in A]
A = np.array(A * 2)
for i in range(n):
	for j in range(i + 1, i + n + 1):
		S = A[i:j]
		t = S.sum(axis=0)
		ans = max(ans, np.hypot(*t))
print(ans)


import numpy as np
N = int(input())
XY = np.array([list(map(int, input().split())) for _ in [0] * N])
ans = 0
for m in range(100):
	th = 2 * np.pi * m / 100
	r = np.array([np.cos(th), np.sin(th)])
	check = XY.dot(r) >= 0
	ans = max(ans, np.linalg.norm(np.sum(XY[check], axis=0)))
print(ans)


import sys
import math
input = sys.stdin.readline
N = int(input())
xys = []
for _ in range(N):
	xys.append(list(map(int, input().split())))

def z(mx, my):
	(rx, ry) = (0, 0)
	for (x, y) in xys:
		if x * mx + y * my > 0:
			(rx, ry) = (rx + x, ry + y)
	return pow(pow(rx, 2) + pow(ry, 2), 1 / 2)
M = 1000
r = 0
for i in range(M):
	k = 2 * (i / M) * math.pi
	r = max(r, z(math.cos(k), math.sin(k)))
print(r)


import sys
import numpy as np
import math

def input():
	return sys.stdin.readline().rstrip()

def main():
	n = int(input())
	engine = np.zeros((n, 3))
	for i in range(n):
		(engine[i][0], engine[i][1]) = map(int, input().split())
		engine[i][2] = math.atan2(engine[i][1], engine[i][0])
	engines = engine[np.argsort(engine[:, 2])]
	sumen = sum(engines)
	ans = sumen[0] ** 2 + sumen[1] ** 2
	for i in range(n):
		for j in range(i, n):
			sump = sum(engines[i:j + 1])
			ans = max(ans, sump[0] ** 2 + sump[1] ** 2, (sump[0] - sumen[0]) ** 2 + (sump[1] - sumen[1]) ** 2)
	print(math.sqrt(ans))

def __starting_point():
	main()
__starting_point()


import math
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
	(x, y) = info[i]
	info[i] = (math.atan2(y, x), x, y)
info = sorted(info)
info = info + info
ans = 0
for i in range(n):
	(x, y) = (0, 0)
	for j in range(i, i + n):
		(_, xp, yp) = info[j]
		x += xp
		y += yp
		ans = max(ans, (x ** 2 + y ** 2) ** 0.5)
print(ans)


from math import sqrt
N = int(input())
engine = {}
tan_key = []
tan_key_infty = []
for i in range(N):
	(x, y) = map(int, input().split())
	if x != 0:
		tan = y / x
	else:
		tan = -10 ** 10
	if tan in tan_key:
		engine[tan].append((x, y))
	else:
		engine[tan] = [(x, y)]
		tan_key.append(tan)
tan_key.sort()
left_coordinate = [0, 0]
right_coordinate = [0, 0]
for tan in tan_key:
	for (x, y) in engine[tan]:
		if x > 0:
			right_coordinate[0] += x
			right_coordinate[1] += y
		elif x < 0:
			left_coordinate[0] += x
			left_coordinate[1] += y
max_left = sqrt(left_coordinate[0] ** 2 + left_coordinate[1] ** 2)
max_right = sqrt(right_coordinate[0] ** 2 + right_coordinate[1] ** 2)
d = 2 * len(tan_key) - 1
for i in range(d):
	if i % 2 == 0:
		for (x, y) in engine[tan_key[i // 2]]:
			if x > 0:
				left_coordinate[0] += x
				left_coordinate[1] += y
			elif x < 0:
				right_coordinate[0] += x
				right_coordinate[1] += y
			elif x == 0:
				if y > 0:
					right_coordinate[0] += x
					right_coordinate[1] += y
				else:
					left_coordinate[0] += x
					left_coordinate[1] += y
	else:
		for (x, y) in engine[tan_key[(i + 1) // 2]]:
			if x > 0:
				right_coordinate[0] -= x
				right_coordinate[1] -= y
			elif x < 0:
				left_coordinate[0] -= x
				left_coordinate[1] -= y
	max_left = max(max_left, sqrt(left_coordinate[0] ** 2 + left_coordinate[1] ** 2))
	max_right = max(max_right, sqrt(right_coordinate[0] ** 2 + right_coordinate[1] ** 2))
print(max(max_left, max_right))


N = int(input())
xy = [list(map(int, input().split())) for i in range(N)]

def dfs(c):
	return pow(pow(c[0], 2) + pow(c[1], 2), 1 / 2)
Case = []
pn = [2]
A = 100
for L in range(3, A):
	for L2 in pn:
		if L % L2 == 0:
			break
	else:
		pn.append(L)
		if N % L != 0:
			Case.append(L)
ans = 0
res = 0
for i in range(N):
	now = [0, 0]
	for j in range(i, i + N):
		j %= N
		tmp = [now[0] + xy[j][0], now[1] + xy[j][1]]
		if dfs(tmp) > dfs(now):
			now = tmp
	if dfs(now) > res:
		res = dfs(now)
	for c in Case:
		now = [0, 0]
		for j in range(i, i + N):
			j = j * c % N
			tmp = [now[0] + xy[j][0], now[1] + xy[j][1]]
			if dfs(tmp) > dfs(now):
				now = tmp
		if dfs(now) > res:
			res = dfs(now)
print(res)


import math
N = int(input())
x = []
y = []
for _ in range(N):
	(u, v) = map(int, input().split())
	x.append(u)
	y.append(v)
ans = 0.0
for deg in range(360):
	rad = deg * math.pi / 180.0
	(u, v) = (math.cos(rad), math.sin(rad))
	(x0, y0) = (0.0, 0.0)
	for n in range(N):
		if 0.0 <= u * x[n] + v * y[n]:
			x0 += x[n]
			y0 += y[n]
	ans = max(ans, math.sqrt(x0 ** 2 + y0 ** 2))
print(ans)


from math import atan2, sqrt
N = int(input())
E = []
for _ in range(N):
	(x, y) = map(int, input().split())
	d = atan2(y, x)
	E.append((d, x, y))
E.sort()
dp = [[(0, 0)] * N for _ in range(N)]
ans = 0
for i in range(N):
	(_, xi, yi) = E[i]
	dist = xi ** 2 + yi ** 2
	ans = max(ans, dist)
	dp[i][i] = (xi, yi)
	for j in range(i + 1, i + N):
		j %= N
		(_, xj, yj) = E[j]
		dp[i][j] = (dp[i][j - 1][0] + xj, dp[i][j - 1][1] + yj)
		dist = dp[i][j][0] ** 2 + dp[i][j][1] ** 2
		ans = max(ans, dist)
print(sqrt(ans))


import math
n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
xy.sort(key=lambda x: math.atan2(x[1], x[0]))
xyrad = [math.atan2(xy[i][1], xy[i][0]) for i in range(n)]
ans = []
(x, y) = list(zip(*xy))
(xsum, ysum) = (sum(x), sum(y))
eps = 10 ** (-8)
for i in range(n):
	(xs, ys) = (0, 0)
	for j in range(i, i + n):
		xs += xy[j % n][0]
		ys += xy[j % n][1]
		ans.append(math.hypot(xs, ys))
print(max(ans))


import math
n = int(input())
vec = []
(xs, ys) = (0, 0)
for _ in range(n):
	(x, y) = map(int, input().split())
	t = math.atan2(y, x)
	if t < 0:
		t += 2 * math.pi
	xs += x
	ys += y
	vec.append((t, x, y))
vec.sort()
max_val = xs * xs + ys * ys
for l in range(n):
	for m in range(1, n):
		val = 0
		(x, y) = (0, 0)
		for i in range(l, l + m):
			(_, xi, yi) = vec[i % n]
			x += xi
			y += yi
		max_val = max(max_val, x * x + y * y)
print(math.sqrt(max_val))


import math
N = int(input())
e = []
for i in range(N):
	(x, y) = map(int, input().split())
	t = math.atan2(y, x)
	e.append((x, y, t))
	e.append((x, y, t + 2 * math.pi))
e.sort(key=lambda z: z[2])
sqans = 0
for i in range(N):
	dx = e[i][0]
	dy = e[i][1]
	sqans = max(sqans, dx ** 2 + dy ** 2)
	for j in range(i + 1, i + N):
		dx += e[j][0]
		dy += e[j][1]
		sqans = max(sqans, dx ** 2 + dy ** 2)
ans = math.sqrt(sqans)
print(ans)