N = gets.to_i
x,y = N.times.map { gets.split.map(&:to_i) }.transpose

x_ans = 0
y_ans = 0

# 正負の採択方向を求める(x)
sum_px = 0
sum_mx = 0
x.each do |xi|
  if xi > 0
    sum_px += xi
  else
    sum_mx += xi
  end
end

x_plus = if sum_px.abs > sum_mx.abs
          true
        else
          false
        end

# 正負の採択方向を求める(y)
sum_py = 0
sum_my = 0
y.each do |yi|
  if yi > 0
    sum_py += yi
  else
    sum_my += yi
  end
end

y_plus = if sum_py.abs > sum_my.abs
          true
        else
          false
        end

# エンジンの採用
N.times do |i|
  # xが正の方向に進むなら正
  x_tmp = x_plus ? x[i] : x[i] * -1
  y_tmp = y_plus ? y[i] : y[i] * -1

  # トータルで決めた方向へ進むなら採用
  if x_tmp + y_tmp >= 0
    x_ans += x[i]
    y_ans += y[i]
  end
end

p Math.sqrt((x_ans ** 2) + (y_ans ** 2))