#include <bits/stdc++.h>
using namespace std;
void Emsawy() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const double PI = acos(-1.0);
const double eps = 1e-10;
const long long mod = 1e9 + 7, oo = 1e9;
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
vector<vector<pair<int, int> > > adj;
int n, m, k, t;
const int N = 4001;
int L[N], R[N];
long dp[89][2002][89 * 2 + 10];
long go(int l, int r, int k) {
  long &ret = dp[k][l][n - r - l + 89];
  if (ret != -oo) return ret;
  if (l <= (n - r)) {
    ret = -oo;
    if (r - l > k) ret = max(ret, go(l + k, r, k) - L[l] + L[l + k]);
    if (r - l > k + 1)
      ret = max(ret, go(l + k + 1, r, k + 1) - L[l] + L[l + k + 1]);
    return (ret == -oo ? ret = 0 : ret);
  }
  ret = oo;
  if (r - l > k) ret = min(ret, go(l, r - k, k) - (-R[r] + R[r - k]));
  if (r - l > k + 1)
    ret = min(ret, go(l, r - k - 1, k + 1) - (-R[r] + R[r - k - 1]));
  return (ret == oo ? ret = 0 : ret);
}
int main() {
  Emsawy();
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      cin >> L[i];
      R[i] = L[i];
      L[i] += L[i - 1];
    }
    for (int i = n - 1; i >= 1; i--) R[i] += R[i + 1];
    for (int i = 0; i < 89; i++) {
      for (int j = 0; j < 2002; j++) {
        for (int g = 0; g < 89 * 2 + 10; g++) {
          dp[i][j][g] = -oo;
        }
      }
    }
    n += 1;
    cout << go(0, n, 1) << endl;
  }
  return 0;
}
