#include<stdio.h>
#include<math.h>
int N,r[575],i;
double x=0;
double max(double a,double b){return a>b?a:b;}
double min(double a,double b)
{
	return a<b?a:b;
}
double ch(int r1,int r2)
{
	if(abs(r1-r2)<0.001)
		return r1+r2;
	double a=abs(r1+r2),b=abs(r1-r2);
	return sqrt(a*a-b*b);
}

double ch2(int r1,int r2)
{
	double t=ch(r1,r2);
	if(r1+t<=r2)return 0;
	if(t>=r2)return r1;
	return r1-(t-r2);
}

int main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&r[i]);
	if(N==1)
	{
		x=r[0]*2;
	}
	else
	{
		for(i=0;i<N-1;i++)
		{
			double l=ch(r[i],r[i+1]);
			if(l<max(r[i],r[i+1]))
				l=1.0*max(r[i],r[i+1]);
			x+=l;

		}
		x+=ch2(r[0],r[1]);
		x+=ch2(r[N-1],r[N-2]);
	}
	printf("%lf\n",x);
	return 0;
}