#include <cstdio>
#include <cstring>
#include <cmath>

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <set>
#include <map>

using namespace::std;

#define ls t<<1
#define rs (t<<1)|1
#define sqr(x) ((x)*(x))

const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
const int maxn = 500 + 10;
const int maxm = 1e4 + 10;
const int mod = 1e9 + 7;
int n;
double d[maxn], r[maxn];

int main()
{
	while (~scanf("%d", &n))
	{
		for (int i = 0; i < n; i++)
			scanf("%lf", &r[i]);
		memset(d, 0, sizeof(d));
		d[0] = r[0];
		for (int i = 1; i < n; i++)
		{
			for (int j = i - 1; j >= 0; j--)
				d[i] = max(d[j] + 2 * sqrt(r[i] * r[j]), d[i]);
			d[i] = max(r[i], d[i]);
		}
		double ans = 0;
		for (int i = 0; i < n; i++)
			ans = max(ans, r[i] + d[i]);
		printf("%.8lf\n", ans);
	}
}