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.

Difficulty: interview

Starter code:

Solutions:
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)


# 凸包 Monotone Chain O(nlogn)
# 参考: https://matsu7874.hatenablog.com/entry/2018/12/17/025713
def get_convex_hull(points):
    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])
    points.sort()
    ch = []
    for p in points:
        while len(ch) > 1:
            v_cur = sub(ch[-1], ch[-2])
            v_new = sub(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 = sub(ch[-1], ch[-2])
            v_new = sub(p, ch[-2])
            if det(v_cur, v_new) > 0:
                break
            ch.pop()
        ch.append(p)
    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)

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


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


def __starting_point():
    main()

__starting_point()

import math
N = int(input())
n = 1000

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = list(map(int, input().split()))

ans = 0
for i in range(n):
    theta = (2 * math.pi / n) * i
    tmp_x = 0
    tmp_y = 0
    for j in range(N):
        if x[j] * math.cos(theta) + y[j] * math.sin(theta) > 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)


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


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(y, x)
        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)


def __starting_point():
    main()

__starting_point()

import math
def arg(x,y):
  if x==0:
    if y>0:
      return math.pi/2
    else:
      return 3*math.pi/2
  else:
    if 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)

import sys
from math import *

sys.setrecursionlimit(10 ** 6)

def main():
    n = int(input())
    en = []
    n0 = n
    for _ in range(n0):
        x, y = list(map(int, input().split()))
        if (x, y) == (0, 0):
            n -= 1
            continue
        en.append([atan2(y, x), x, y])
    en.sort()
#    print(en)

    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()


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())
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)
    else:
        if 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)))


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)

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


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)) # (theta, 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)

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()


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 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
        else:
            if (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 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


ans = 0
for i in range(2 * N + 1):
    for j in range(2 * N + 1):
        if j - i <= N:
            ans = max(ans, abs(sum(XY[i:j])))

print(ans)

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
    #print(start,end,N,L(start,end,N))
    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 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 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
    # 各エンジンを先頭に、そこから pi の範囲にあるエンジンをすべて用いて進行し、距離を算出する。
    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
        # search_criteria = lambda x, y: True if x1*x + y1*y > 0 else False

        x_sum = 0
        y_sum = 0
        for x, y, angle in engines[cnt:] + engines[:cnt]:
            if search_criteria(angle):
            # if search_criteria(x, y):
                x_sum += x
                y_sum += y
            dist_max = max(dist_max, math.sqrt(x_sum**2 + y_sum**2))
    
    print(dist_max)

main()

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))  # -pi~pi
    angles.append((angle + pi2, i))  # pi~3pi
    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 - 1e-9
    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)


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)


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 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]))
#a.sort(key=cmath.phase)
ma=0
#math.piに注意
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])
    #(0,0)の時は偏角が0になってしまうし、除く
    #あとは-piとpiどっちになるか→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
#math.piに注意
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 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)

# -*- coding: utf-8 -*-
import math



def main():
    N = int(input())
    E = []
    for i in range(N):
        x, y = list(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)

def __starting_point():
    main()

__starting_point()

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)) # (theta, 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:]
  # l番目のベクトルの微小角小さいところに境界面を設定
  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) # 境界面の両面をチェック
  # l番目のベクトル丁度(微小角大きいところ)に境界面を設定
  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)

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)

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

    # x
    # plus, plus
    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))

    # x
    # plus, minus
    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))

    # x
    # minus, plus
    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))

    # x
    # minus, minus
    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))

    # y
    # plus, plus
    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))

    # y
    # plus, minus
    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))

    # y
    # minus, plus
    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))

    # y
    # minus, minus
    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
            else:
                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))
        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 math import atan2, pi

n = int(input())
e = []

for _ in range(n):
    x, y = list(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)
    return

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

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)


# 複素数版

# 凸包 Monotone Chain O(nlogn)
# 参考: https://matsu7874.hatenablog.com/entry/2018/12/17/025713
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)


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()

def solve():
    from math import atan2, degrees, hypot
    n = int(input())
    txy = []
    sx, sy = 0, 0
    for i in range(n):
        a, b = list(map(int, input().split()))
        theta_0 = degrees(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 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)))
for i in range(N):
    for j in range(i+1,i+N+1):
        r = n(Sxy[min(j,N)]-Sxy[i] + Sxy[max(0,j-N)])
        ans = max(ans,r)
print(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 = list(map(sum, list(zip(*engines[L:R+1]))))
        else:
            x, y = list(map(sum, list(zip(*(engines[:R+1]+engines[L:])))))
        dist = hypot(x, y)
        ans = max(ans, dist)

print(ans)


# -*- coding: utf-8 -*-

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()
# 2周目をつける
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
    # 始点から180度未満の方向に向かうものを全て追加しながら最大を取る
    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 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]]
    else:
        if 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))


import cmath
import math

N = int(input())
pc = []
for i in range(N):
  x, y = 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
    #print(start,end,N,L(start,end,N))
    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 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))

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()

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
for i in range(N):
    for j in range(i+1,i+N+1):
        r = np.linalg.norm(XY[i:j].sum(axis=0)+XY[:max(0,j-N)].sum(axis=0))
        ans = max(ans,r)
print(ans)

import math
N = int(input())
n = 72

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = list(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)


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)


def __starting_point():
    main()

__starting_point()

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))
#x+yiのargument[-pi,pi]の小さい方から順に並べる
xy += xy
#同じものを複製
ans = 0
for l in range(n):
    a = [0,0] # 最後にたどり着く座標
    for r in range(l,min(2*n,l+n)):#l番目含めlからn個について
        a[0] += xy[r][0]
        a[1] += xy[r][1]
        ans = max(ans,abs(a[0]+a[1]*1j))
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)
    else:
        if 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)))

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()

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)

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

# 無理やり0.1度ずつ行先を回す。

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())
pi = 3.141592653589793238462643383279
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)
    #assert pi <= ret <= pi, 'range over'
    return ret  # -pi <= a <= pi


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 -0.000001 <= anglist[i] <= pi / 2+0.000001:
            finalxy.append(xy[i])
    d.append(dist(finalxy))

print((max(d)))


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]))
XY += XY

ans = 0
for i in range(n):
    x = 0
    y = 0
    for j in range(n):
        nx,ny = XY[i+j]
        x += nx
        y += ny
        ans = max(ans,(x**2+y**2)**0.5)
print(ans)

from itertools import combinations
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


ans = 0
for i, j in combinations(range(2 * N + 1), 2):
    if j - i <= N:
        ans = max(ans, abs(sum(XY[i:j])))

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)

def f_engines():
    import math
    N = int(input())
    # 2πをまたぐようなベクトルの選び方を楽にするため、要素数を2倍
    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):
        # 他の人の提出には1重ループのものもあるが、それでいい理屈がわからない
        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())

import numpy as np

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

# 内積が0以上かどうか
def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0 : return 1
    else: return 0

# 内積が0かどうか
def is90deg(v1, v2):
    if np.dot(v1, v2) == 0 : return 1
    else: return 0

ans = []
for i in range(n):
    # tangent-vector, normal-vector
    tv, nv1 = np.array([x[i],y[i]]), np.array([y[i],-x[i]])
    nv2 = - nv1
    # tvから時計回り180度エリアにおけるベクトル和を考える
    # ただし、tvに平行なベクトル群（posi/nega）だけ例外処理
    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, degrees, hypot
    n = int(input())
    txy = []
    sx, sy = 0, 0
    for i in range(n):
        a, b = list(map(int, input().split()))
        theta_0 = degrees(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())
n = 1000

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = list(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)


import math
N = int(input())
X = []
for _ in range(N):
    x, y = list(map(int, input().split()))
    X.append((math.atan2(x, y), x, y))

X = sorted(X) * 2
m = 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
        m = max(m, d)

print((m**0.5))


import sys
input = sys.stdin.readline
import math
# キュー(FIFO)
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
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)

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)


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) ** .5)
print(ans)


import math

N = int(input())
V = []
for _ in range(N):
    V.append([ int(n) for n in input().split() ])

R2 = 0
for i in range(100):
    theta = 2*math.pi * i / 100
    a, b = math.cos(theta), math.sin(theta)
    X, Y = 0, 0
    for x, y in V:
        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 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 math
N = int(input())
n = 72

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = list(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)


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


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 (list(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)))


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

def __starting_point():
    main()
__starting_point()

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 i, j in combinations(range(2 * N + 2), 2):
    if j - i <= N:
        x1, y1 = xy[i]
        x2, y2 = xy[j]
        candidate = (x1 - x2) ** 2 + (y1 - y2) ** 2
        if candidate > answer:
            answer = candidate

print(answer ** 0.5)

# Engines
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)

import math

n = int(input())
P = []
#very small でWAなので、rで割ってかけ直すのをやめてみる
#atanを使ってみる
#0またいだときがおかしいか
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 atan2, pi, sqrt
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=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())
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):
  for j in range(i+1,i+n+1):
    X = 0
    Y = 0
    for k in range(i,j):
      x,y = xy[k][1],xy[k][2]
      X += x
      Y += y
    can.append(X**2+Y**2)
if n == 0:
  print(0)
else:
  print(max(can)**.5)

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)

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))  # -pi~pi
    angles.append((angle + pi2, i))  # pi~3pi
    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)


import math
 
N = int(input())
V = []
for _ in range(N):
    V.append([ int(n) for n in input().split() ])
 
R2 = 0
for i in range(100): 
    theta = 2 * math.pi * i / 100  
    a, b = math.cos(theta), math.sin(theta)  ### a=cosθ、b=sinθ　（θ=2π*i/100） 
    X, Y = 0, 0
    for x, y in V: ### xi と yi を取り出す
        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 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)

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)

#解説解法
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)**.5)

import math
N = int(input())
n = 60

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = list(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)


import math
N = int(input())
X = []
for _ in range(N):
    x, y = list(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))


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()


def solve():
    from math import atan2, pi, hypot
    n = int(input())
    txy = []
    sx, sy = 0, 0
    for i in range(n):
        a, b = list(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 = [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 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
for i in range(N):
    for j in range(i+1,i+N+1):
        r = n(XY[i:j].sum(axis=0)+XY[:max(0,j-N)].sum(axis=0))
        ans = max(ans,r)
print(ans)

import math
N = int(input())
X = []
for _ in range(N):
    x, y = map(int, input().split())
    X.append((math.atan2(x, y), 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 = 100

x = [None] * N
y = [None] * N
for i in range(N):
    x[i], y[i] = list(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)


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)