#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32000000")
using namespace std;
inline bool read(int& val) { return scanf("%d", &val) != -1; }
inline bool read(long long& val) { return scanf("%I64d", &val) != -1; }
inline bool read(double& val) { return scanf("%lf", &val) != -1; }
inline bool read(char* val) { return scanf("%s", val) != -1; }
template <class T1, class T2>
inline bool read(T1& a, T2& b) {
  return read(a) && read(b);
}
template <class T1, class T2, class T3>
inline bool read(T1& a, T2& b, T3& c) {
  return read(a) && read(b) && read(c);
}
template <class T1, class T2, class T3, class T4>
inline bool read(T1& a, T2& b, T3& c, T4& d) {
  return read(a) && read(b) && read(c) && read(d);
}
template <class T1, class T2, class T3, class T4, class T5>
inline bool read(T1& a, T2& b, T3& c, T4& d, T5& e) {
  return read(a) && read(b) && read(c) && read(d) && read(e);
}
const int nil = -1;
const int N = 4444;
struct node {
  short f, l, r, k;
  node() {}
  node(short f, short l, short r, short k) : f(f), l(l), r(r), k(k) {}
  friend bool operator!=(node a, node b) {
    return (long long&)a != (long long&)b;
  }
  int hash() { return (((1ll * f * N + l) * N) + r) * N + k; }
};
struct hashtable {
  static const int n = 11111111;
  int next[n];
  int head[n];
  node key[n];
  int val[n];
  int id = 0;
  void init() {
    id = 0;
    for (int i = 0, _ = (n); i < _; ++i) head[i] = nil;
  }
  int& operator[](node x) {
    int l = x.hash() % n;
    int i = head[l];
    while (i != nil && key[i] != x) i = next[i];
    if (i == nil) {
      next[id] = head[l];
      head[l] = id;
      key[id] = x;
      val[id] = 1e9;
      i = id++;
    }
    return val[i];
  }
};
hashtable dp;
int num[N];
int sum[N];
int search(node n) {
  if (dp[n] != 1e9) return dp[n];
  if (n.r - n.l < n.k) return 0;
  if (n.r - n.l == n.k) return n.f ? sum[n.r] - sum[n.l] : sum[n.l] - sum[n.r];
  if (n.f) {
    int ll1 = n.l + n.k, ll2 = ll1 + 1;
    int val1 = sum[ll1] - sum[n.l];
    int val2 = sum[ll2] - sum[n.l];
    val1 += search(node(!n.f, ll1, n.r, n.k));
    val2 += search(node(!n.f, ll2, n.r, n.k + 1));
    int val = max(val1, val2);
    return dp[n] = val;
  } else {
    int rr1 = n.r - n.k, rr2 = rr1 - 1;
    int val1 = sum[rr1] - sum[n.r];
    int val2 = sum[rr2] - sum[n.r];
    val1 += search(node(!n.f, n.l, rr1, n.k));
    val2 += search(node(!n.f, n.l, rr2, n.k + 1));
    int val = min(val1, val2);
    return dp[n] = val;
  }
}
int main() {
  dp.init();
  int n;
  read(n);
  for (int i = 0, _ = (n); i < _; ++i) read(num[i]);
  sum[0] = 1;
  for (int i = 0, _ = (n); i < _; ++i) sum[i + 1] = sum[i] + num[i];
  int ans = search(node(1, 0, n, 1));
  printf("%d\n", ans);
  return 0;
}
