/*  -*- coding: utf-8 -*-
 *
 * 1357.cc: Squeeze the Cylinders
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 500;

/* typedef */

/* global variables */

int rs[MAX_N];
double xs[MAX_N];

/* subroutines */

inline void setmax(double &a, double b) { if (a < b) a = b; }

/* main */

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) scanf("%d", rs + i);

  double sum = 0.0;
  for (int i = 0; i < n; i++) {
    xs[i] = rs[i];
    for (int j = i - 1; j >= 0; j--) {
      int p = rs[i] + rs[j], m = rs[i] - rs[j];
      double x = xs[j] + sqrt((double)(p * p - m * m));
      setmax(xs[i], x);
    }
    setmax(sum, xs[i] + rs[i]);
  }

  printf("%.8lf\n", sum);
  return 0;
}

