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

int main(void) {
	int N;
	int cylinders[512];
	int i, j;
	double cylinders_pos[512];
	double max, current;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &cylinders[i]) != 1) return 1;
	}
	for (i = 0; i < N; i++) {
		max = cylinders[i];
		for (j = 0; j < i; j++) {
			current = cylinders_pos[j] + sqrt(
				(cylinders[j] + cylinders[i]) * (cylinders[j] + cylinders[i]) -
				(cylinders[j] - cylinders[i]) * (cylinders[j] - cylinders[i]));
			if (current > max) max = current;
		}
		cylinders_pos[i] = max;
	}
	max = 0;
	for (i = 0; i < N; i++) {
		current = cylinders_pos[i] + cylinders[i];
		if (current > max) max = current;
	}
	printf("%.15f\n", max);
	return 0;
}