//喜欢如此简单的代码 但是我却如此的蠢
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <queue>
#include <limits.h>
#include <string.h>
#include <vector>
#include <map>
#include <math.h>
#define LL long long
#define INF 2100000000
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define eps 5e-7
#define getr(x,y) x*y/(x+y+2.0*sqrt(x*y))
#define getd(x,y) 2.0*sqrt(x*y)
#define judgel(r,x) r+sqrt(2*x*r+r*r)<=x
using namespace std;
const int maxn=(int)1e6 +10;
const LL MOD=(LL)1e9+7;
int n;
double r[maxn];
double x[maxn];
int main(){
#ifdef shuaishuai
freopen("C:\Users\hasee\Desktop\a.txt","r",stdin);
//freopen("C:\Users\hasee\Desktop\b.txt","w",stdout);
#endif
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%lf",r+i);
if(n==1){printf("%.6lf
",2*r[0]);return 0;}
x[0]=0;
double ll = -r[0],rr=r[0];
for(int i=1;i<n;i++){
double p=0;
for(int j=i-1;j>=0;j--){
p=max(p,x[j]+getd(r[i],r[j]));
}
x[i]=p;
ll=min(ll,x[i]-r[i]);
rr=max(rr,x[i]+r[i]);
}
// for(int i=0;i<n;i++)
// printf("%d %.3lf
",i,x[i]);
printf("%.6lf
",rr-ll);
return 0;
}