// AOJ 1357: Squeeze the Cylinders
// 2017.10.24 bal4u@uu

#include <stdio.h>
#include <math.h>

int r[500];
double x[501];

int main()
{
	int n, i, j;
	double t, max, ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", r+i);
	ans = 0;
	for (i = 0; i < n; i++) {
		max = r[i];
		for (j = 0; j < i; j++) {
			t = x[j] + sqrt((r[i]+r[j])*(r[i]+r[j]) - (r[i]-r[j])*(r[i]-r[j]));
			if (t > max) max = t;
		}
		x[i] = max;
		if (x[i] + r[i] > ans) ans = x[i] + r[i];
	}
	printf("%.8lf\n", ans);
	return 0;
}