#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=100111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};

double r[505];
double ans=0,x[505];
double dfs(int stand,int now,double xx){
	double ans_tmp=0;
	//stand番目の円が取りうる最大のx座標がx.
	//now番目の円とstand番目の円を比較する.
	if(now<0||x[now]+r[now]<x[stand]-r[stand])return xx;
	double dist_tmp=sqrt(pow(r[stand]+r[now],2)-pow(r[stand]-r[now],2));
	ans_tmp=max(ans_tmp,dfs(stand,now-1,max(xx,x[now]+dist_tmp)));
	return ans_tmp;
}

int main(){
	int n;
	//r[i]=i番目の円の半径.
	//x[i]=i番目の円のx座標.
	cin>>n;
	rep(i,0,n)cin>>r[i];
	x[0]=r[0];
	//x座標を決めていく.
	rep(i,1,n)x[i]=dfs(i,i-1,max(r[i],x[i-1]));
	rep(i,0,n)ans=max(ans,x[i]+r[i]);
	print(setprecision(15)<<ans);
}
