#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
const int OO = 1e9;
int n;
int a[N];
int __s[N];
int &s(int i) { return __s[1 + i]; }
int sum(int l, int r) {
  if (l > r) return 0;
  return s(r) - s(l - 1);
}
const int BUCKETS = 6.2e7;
unsigned int Hash(int l, int r, int k, int p) {
  unsigned int ret = 0;
  ret += p;
  ret += k << 1;
  ret += r << 8;
  ret += l << 24;
  return ret;
}
int buckets[62000009];
int &dp(int l, int r, int k, int p) {
  return buckets[Hash(l, r, k, p) % BUCKETS];
}
const int maxn = 4000, maxk = 80;
int DP(int l, int r, int k, int p) {
  if ((r - l + 1) / k == 0) {
    return 0;
  }
  if (r - l + 1 == k) {
    return p ? sum(l, r) : -sum(l, r);
  }
  if (dp(l, r, k, p) != -1) return dp(l, r, k, p);
  int ret;
  if (p) {
    ret = -OO;
    ret = max(ret, DP(l + k, r, k, !p) + sum(l, l + k - 1));
    ret = max(ret, DP(l + k + 1, r, k + 1, !p) + sum(l, l + k));
  } else {
    ret = OO;
    ret = min(ret, DP(l, r - k, k, !p) - sum(r - k + 1, r));
    ret = min(ret, DP(l, r - k - 1, k + 1, !p) - sum(r - k, r));
  }
  dp(l, r, k, p) = ret;
  return ret;
}
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int(i) = (0); !((i) == (n)); (n) > (0) ? (i)++ : (i)--) {
    cin >> a[i];
    s(i) = s(i - 1) + a[i];
  }
  fill(buckets, buckets + BUCKETS, -1);
  cout << DP(0, n - 1, 1, 1) << endl;
  return 0;
}
