//?????????????????????????¢??????????????????????, ??????????????????????????¨???????????§?????????
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;

int n;
double r[500];
double pos[500];	//pos[i] = ???i????????????x??§?¨? (???????£???????????????¢)

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> r[i];
	
	pos[0] = r[0];
	for (i = 1; i < n; i++) {
		pos[i] = r[i];
		for (j = 0; j < i; j++) {
			double sub = max(r[i], r[j]) - min(r[i], r[j]);
			double plus = r[i] + r[j];
			double dist = sqrt(plus * plus - sub * sub);
			pos[i] = max(pos[i], pos[j] + dist);
		}
	}
	
	double ans = 0;
	for (i = 0; i < n; i++) {
		ans = max(r[i] + pos[i], ans);
	}
	
	printf("%.14f\n", ans);
	return 0;
}