#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;

template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()){
		out << v[i] <<", ";
	}
	return out << "}" << endl;
}

int N;

int main() {
	
	cin >> N;
	vi a(N);
	vector<double> d(N);
	double ans = 0;

	rep(i,N){
		cin >> a[i];
		double pos = a[i];
		rep(j, i){
			double s = a[j] + a[i], t = a[j] - a[i];
			pos = max(pos, sqrt(s * s - t * t) + d[j]);
		}
		d[i] = pos;
		ans = max(ans, pos + a[i]);
	//	cout << pos << endl;
	}

	printf("%.6f\n", ans);
	return 0;
}