#include <bits/stdc++.h>
using namespace std;
int n;
int a[4010];
int dp[4001][70][70][2];
const int INF = 1e9 + 7;
int fanc(int x, int y, int z, int t) {
  if (dp[x][y][z][t] < INF) return dp[x][y][z][t];
  if (t == 0) {
    if (x + x + z + y + z < n) {
      dp[x][y][z][t] =
          max(fanc(x + y + z, y, z, 1), fanc(x + y + z + 1, y + 1, z, 1));
    } else if (x + x + z + y + z == n) {
      dp[x][y][z][t] = fanc(x + y + z, y, z, 1);
    } else {
      dp[x][y][z][t] = a[x] + a[n - x - z] - a[n];
    }
  } else {
    if (x + x + z < n) {
      dp[x][y][z][t] = min(fanc(x, y, z, 0), fanc(x, y, z + 1, 0));
    } else if (x + x + z == n) {
      dp[x][y][z][t] = fanc(x, y, z, 0);
    } else {
      dp[x][y][z][t] = a[x] + a[n - x + y] - a[n];
    }
  }
  return dp[x][y][z][t];
}
int main() {
  scanf("%d", &n);
  for (int i = (int)(1); i < (int)(n + 1); ++i) {
    scanf("%d", a + i);
    a[i] += a[i - 1];
  }
  for (int i = (int)(0); i < (int)(n + 1); ++i) {
    for (int j = (int)(0); j < (int)(70); ++j) {
      for (int k = (int)(0); k < (int)(70); ++k) {
        dp[i][j][k][0] = dp[i][j][k][1] = INF;
      }
    }
  }
  printf("%d\n", fanc(0, 1, 0, 0));
  return 0;
}
