#include<iostream>  
#include<algorithm>  
#include<string>  
#include<map>//ll dx[4]={0,0,-1,1};ll dy[4]={-1,1,0,0};  
#include<set>//  
#include<vector>  
#include<cmath>  
#include<stack>  
#include<string.h>  
#include<stdlib.h>  
#include<cstdio>  
#define mod 1e9+7  
#define ll long long
using namespace std;  
double y[1010];
double x[1010];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i)
		cin>>x[i];
	double s=0;
	if(n==1){
		printf("%.6f\n",2*x[0]);
		return 0;
	}
	y[0]=x[0];
	for(int i=1;i<n;++i){
		double g=sqrt((x[i]+x[i-1])*(x[i]+x[i-1])-(x[i]-x[i-1])*(x[i]-x[i-1]));
		double p=y[i-1]+g;
		for(int j=i-2;j>=0;--j){
			g=sqrt((p-y[j])*(p-y[j])+(x[i]-x[j])*(x[i]-x[j]));
			if(g<x[i]+x[j]){
				double h=sqrt((x[i]+x[j])*(x[i]+x[j])-(x[i]-x[j])*(x[i]-x[j]));
				p=max(p,y[j]+h);
			}
		}
		y[i]=max(p,x[i]);
	}
	double maxx=0;
	for(int i=0;i<n;++i){
		maxx=max(maxx,y[i]+x[i]);
	}
	printf("%.6f\n",maxx);
	return 0;
}