#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using pii = pair<int, int>;
using vi = vector<int>;
mt19937 mrand(time(0));
ll get(ll r) { return ((ll)mrand() * mrand() % r + r) % r; }
ll get(ll l, ll r) { return get(r - l + 1) + l; }
int n, a[4100], dp[30000100];
int id(int l, int r, int k, int op) {
  return (((l * 4000ll + r) * 100 + k) * 2 + op) % 29999999;
}
int f(int l, int r, int k, int op) {
  if (r - l + 1 < k) return 0;
  if (~dp[id(l, r, k, op)]) return dp[id(l, r, k, op)];
  if (op) {
    int res = f(l, r - k, k, op ^ 1) - (a[r] - a[r - k]);
    if (r - k - 1 >= l - 1)
      res = min(res, f(l, r - k - 1, k + 1, op ^ 1) - (a[r] - a[r - k - 1]));
    return dp[id(l, r, k, op)] = res;
  } else {
    int res = f(l + k, r, k, op ^ 1) + (a[l + k - 1] - a[l - 1]);
    if (l + k + 1 <= r + 1)
      res = max(res, f(l + k + 1, r, k + 1, op ^ 1) + (a[l + k] - a[l - 1]));
    return dp[id(l, r, k, op)] = res;
  }
}
signed main() {
  scanf("%d", &n), memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] += a[i - 1];
  printf("%d\n", f(1, n, 1, 0));
  fprintf(stderr, "time=%.4f\n", (db)clock() / CLOCKS_PER_SEC);
  return 0;
}
