#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N;
double x[500],r[500];
int main(){
	cin>>N;
	rep(i,N) cin>>r[i];
	rep(i,N){
		x[i]=r[i];
		rep(j,i){
			chmax(x[i],x[j]+sqrt((r[i]+r[j])*(r[i]+r[j]) - (r[i]-r[j])*(r[i]-r[j])));
		}
	}
	double ans=0;
	rep(i,N) chmax(ans,x[i]+r[i]);
	printf("%.12f\n",ans);
}