#include <bits/stdc++.h>
using namespace std;
struct ton {
  vector<pair<long long, long long> > v[1919810 + 3];
  long long& operator()(long long a, int b, int c, int d) {
    a = ((a * 4000ll + b) * 4000ll + c) * 3ll + (d == 1);
    int k = a % 1919810;
    for (auto u = v[k].begin(); u != v[k].end(); u++)
      if (u->first == a) return u->second;
    v[k].push_back(make_pair(a, -1e17));
    return v[k].back().second;
  }
} f;
long long s[100010];
long long F(int l, int r, int k, int p) {
  if (r - l + 1 < k) return 0;
  if (r - l + 1 == k) return p * (s[r] - s[l - 1]);
  long long& u = f(l, r, k, p);
  if (u != -1e17) return u;
  if (p == -1)
    u = min(F(l, r - k, k, 1) - (s[r] - s[r - k]),
            F(l, r - k - 1, k + 1, 1) - (s[r] - s[r - k - 1]));
  else
    u = max(F(l + k, r, k, -1) + (s[l + k - 1] - s[l - 1]),
            F(l + k + 1, r, k + 1, -1) + (s[l + k] - s[l - 1]));
  return u;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &s[i]), s[i] += s[i - 1];
  printf("%lld\n", F(1, n, 1, 1));
  return 0;
}
