N = gets.to_i

engines = []
sum_x = 0
sum_y = 0
for i in 0...N do
  x, y = gets.chomp.split(' ').map(&:to_i)
  engines[i] = [x, y]
  sum_x += x
  sum_y += y
end

max_x = 0
max_y = 0

if sum_x >= 0 && sum_y >= 0 then
  engines.each { |engine|
    if engine[0] >= 0 && engine[1] >= 0 then
      max_x += engine[0]
      max_y += engine[1]
    end
  }
elsif sum_x <= 0 && sum_y >= 0 then
  engines.each { |engine|
    if engine[0] <= 0 && engine[1] >= 0 then
      max_x += engine[0]
      max_y += engine[1]
    end
  }
elsif sum_x <= 0 && sum_y <= 0 then
  engines.each { |engine|
    if engine[0] <= 0 && engine[1] <= 0 then
      max_x += engine[0]
      max_y += engine[1]
    end
  }
elsif sum_x >= 0 && sum_y <= 0 then
  engines.each { |engine|
    if engine[0] >= 0 && engine[1] <= 0 then
      max_x += engine[0]
      max_y += engine[1]
    end
  }
end

p Math.sqrt(max_x.abs ** 2 + max_y.abs ** 2)
