#include <bits/stdc++.h>
using namespace std;
struct Data {
  int l, r, k;
  bool operator<(const Data &ri) const {
    return l < ri.l || l == ri.l && r < ri.r ||
           l == ri.l && r == ri.r && k < ri.k;
  }
};
map<int, int> m[4001][90];
int N, a[4001], dp[4001][2 * 90][90];
int solve(int l, int d, int k) {
  int r = N - l + d - 90;
  if (r - l < k) return 0;
  if (~dp[l][d][k]) return dp[l][d][k];
  if (r - l == k) {
    if (d <= 90) return dp[l][d][k] = a[r] - a[l];
    return dp[l][d][k] = a[l] - a[r];
  }
  if (d <= 90) {
    return dp[l][d][k] =
               max(solve(l + k, d + k, k) + a[l + k] - a[l],
                   solve(l + k + 1, d + k + 1, k + 1) + a[l + k + 1] - a[l]);
  }
  return dp[l][d][k] = min(solve(l, d - k, k) - a[r] + a[r - k],
                           solve(l, d - k - 1, k + 1) - a[r] + a[r - k - 1]);
}
int main() {
  while (scanf("%d", &N) != EOF) {
    memset(dp, -1, sizeof(dp));
    for (int i = int(0); i < int(N); i++) {
      scanf("%d", a + i + 1);
      a[i + 1] += a[i];
    }
    printf("%d\n", solve(0, 90, 1));
  }
  return 0;
}
