# frozen_string_literal: true

N = gets.to_i
$xy = N.times.map { gets.split.map(&:to_i) }
$h = {}
def dfs(x, y, dx, dy, i)
  x += dx
  y += dy
  return $h[[x, y, dx, dy, i]] if $h[[x, y, dx, dy, i]]
  if i == N
    return Math.sqrt(x**2 + y**2)
  end
  ndx = $xy[i][0]
  ndy = $xy[i][1]
  return $h[[x, y, dx, dy, i]] = [dfs(x, y, ndx, ndy, i + 1), dfs(x, y, 0, 0, i + 1)].max
end

puts dfs(0, 0, 0, 0, 0)
