cylinders = []
n = gets.to_i
gets.split.map(&:to_i).each do |r1|
  if cylinders.empty?
    cylinders << [r1, r1]
  else
    x1 = [cylinders.map {|x2, r2| x2 + 2 * Math.sqrt(r1 * r2) }.max, r1].max
    cylinders << [x1, r1]
  end
end
p cylinders.map {|x, r| x + r }.max
