#include <bits/stdc++.h>
using namespace std;
char _;
const int maxN = 4000 + 5;
const int mod = 1000 * 1000 * 1000 + 7;
const int maxL = 20;
int a[maxN];
long long su[maxN];
long long dp[maxN][130][63];
long long sum(int x, int y) { return su[y] - su[x]; }
int n;
inline long long bt(int x, int y, int gam) {
  if (x + y > n) assert(false);
  if (x + y + gam > n) return sum(0, x) - sum(n - y, n);
  if (dp[x][x - y + 65][gam] > -100LL * mod) return dp[x][x - y + 65][gam];
  bool turn = 1;
  if (x <= y) turn = 0;
  if (turn == 0) {
    long long first = bt(x + gam, y, gam);
    long long second = mod * (-100LL);
    if (x + y + gam + 1 <= n) second = bt(x + gam + 1, y, gam + 1);
    return dp[x][x - y + 65][gam] = max(first, second);
  }
  long long first = bt(x, y + gam, gam);
  long long second = mod * 100LL;
  if (x + y + gam + 1 <= n) second = bt(x, y + gam + 1, gam + 1);
  return dp[x][x - y + 65][gam] = min(first, second);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  memset(dp, 128, sizeof dp);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) su[i] = su[i - 1] + a[i - 1];
  cout << bt(0, 0, 1) << endl;
  return 0;
}
