#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define p(S) cout<<S<<endl;
using namespace std;

int N;
double r[510];
double x[510];

double calc_x(double a, double b){
    return sqrt((a+b)*(a+b) - (a-b)*(a-b));
}
double ans;
int main() {
    cin >> N;
    REP(i,0,N) cin>> r[i];

    REP(i,1,N){
        double mx=0;
        RREP(j,0,i) {
            double now = calc_x(r[j], r[i]);
            mx = max(mx, now+x[j]);
            if(r[j]>=r[i]) break;
        }
        x[i]=mx;
    }
    double  mn=0;
    REP(i,0,N) {
        mn = min(mn, x[i] - r[i]);
        ans = max(ans, x[i] + r[i]);
    }
    ans -= mn;

    printf("%.6lf\n", ans);
    return 0;
}
