#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 4e3 + 4;
const int maxm = 2.1e3 + 4;
const double pi = acos(-1.0);
int* dp[maxn][maxn][2];
int sum[maxn], num, n;
int cnt = 0;
int dfs(int l, int r, int who, int k) {
  if (dp[l][r][who] == NULL) {
    int* p = new int[100];
    memset(p, 0x3f, sizeof(int) * 100);
    dp[l][r][who] = p;
  }
  if (dp[l][r][who][k] != inf) return dp[l][r][who][k];
  if (r - 1 - l < k)
    return dp[l][r][who][k] = 0;
  else if (r - l - 1 == k)
    return dp[l][r][who][k] =
               who == 0 ? sum[r - 1] - sum[l] : sum[l] - sum[r - 1];
  if (who == 0) {
    int temp = -inf;
    temp = max(dfs(l + k, r, 1, k) + sum[l + k] - sum[l],
               dfs(l + k + 1, r, 1, k + 1) + sum[l + k + 1] - sum[l]);
    return dp[l][r][who][k] = temp;
  } else {
    int temp = inf;
    temp = min(dfs(l, r - k, 0, k) - (sum[r - 1] - sum[r - k - 1]),
               dfs(l, r - k - 1, 0, k + 1) - (sum[r - 1] - sum[r - k - 2]));
    return dp[l][r][who][k] = temp;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int ik, i, j, k, kase;
  memset(dp, 0, sizeof dp);
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> num;
    sum[i] = sum[i - 1] + num;
  }
  cout << dfs(0, n + 1, 0, 1) << endl;
  return 0;
}
