#include <bits/stdc++.h>
using namespace std;
const int N = (int)4e3 + 5;
const int inf = (int)1e9 + 5;
const int mod = (int)1e9 + 7;
const long long INF = (long long)1e18;
const unsigned int P = 4049;
const double eps = 1e-9;
int n, a[N], second[N];
unordered_map<unsigned int, int> dp;
int calc(int who, int k, int l, int r) {
  if (l > r || r - l + 1 < k) return 0;
  unsigned int h = P * P * P * who + P * P * k + P * l + r;
  if (dp.count(h)) return dp[h];
  int res = -inf;
  if (who == 0) {
    if (k <= r - l + 1)
      res = max(res, -calc(1, k, l + k, r) + second[l + k - 1] - second[l - 1]);
    if (k + 1 <= r - l + 1)
      res = max(res,
                -calc(1, k + 1, l + k + 1, r) + second[l + k] - second[l - 1]);
  } else {
    if (k <= r - l + 1)
      res = max(res, -calc(0, k, l, r - k) + second[r] - second[r - k]);
    if (k + 1 <= r - l + 1)
      res = max(res,
                -calc(0, k + 1, l, r - k - 1) + second[r] - second[r - k - 1]);
  }
  return dp[h] = res;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  dp.reserve(8000000);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    second[i] = second[i - 1] + a[i];
  }
  cout << calc(0, 1, 1, n);
  return 0;
}
