private double solveGame(int[] a) {
		int N = a.length;
		double[] total = new double[N];
		double[] dp = new double[N];
		total[0] = a[0];
		for (int i = 1; i < N; i++) {
			total[i] = total[i - 1] + a[i]; 
		}
		dp[0] = a[0];
		dp[1] = dp[0] + a[1];
		dp[2] = dp[1] + a[2];
		for (int i = 3; i < N; i++) {
			double val = a[i] + total[i - 1] - dp[i - 1];
			val = Math.max(val, a[i] + a[i - 1] + total[i - 2] - dp[i - 2]);
			val = Math.max(val, a[i] + a[i - 1] + a[i - 2] + total[i - 3] - dp[i - 3]);
			dp[i] = val;
		}
		
		return dp[N - 1];
	}