#include <bits/stdc++.h>
using namespace std;
const int N = 4000 + 7;
const int M = 1007;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * inf + 7;
const double pi = acos(-1);
const double eps = 1e-6;
const bool multipleTest = false;
int a[N];
int n;
int dp[N][70][70][2];
inline int calc(int u, int added, int k, int first) {
  int v = 0;
  if (first == 0) {
    v = n - u - added + 1;
  } else {
    v = n - u - added + 1 + k;
  }
  if (v - u + 1 < k) return 0;
  if (dp[u][added][k][first] != -1) return dp[u][added][k][first];
  int &ans = dp[u][added][k][first];
  ans = -inf;
  if (first == 0) {
    ans = max(ans, a[u + k - 1] - a[u - 1] - calc(u + k, added, k, 1));
    if (v - u + 1 >= k + 1)
      ans = max(ans, a[u + k] - a[u - 1] - calc(u + k + 1, added, k + 1, 1));
  } else {
    ans = max(ans, a[v] - a[v - k] - calc(u, added, k, 0));
    if (v - u + 1 >= k + 1)
      ans = max(ans, a[v] - a[v - k - 1] - calc(u, added + 1, k + 1, 0));
  }
  return ans;
}
void solve() {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    a[i] += a[i - 1];
  }
  cout << calc(1, 0, 1, 0) << "\n";
}
void createTest() {
  freopen("in.txt", "w", stdout);
  cout << 100000 << "\n";
  for (int i = 1; i <= 100000; ++i) {
    cout << rand() % inf << " ";
  }
}
int main() {
  if (fopen("f.in", "r")) {
    freopen("f.in", "r", stdin);
    freopen("f.out", "w", stdout);
  }
  int Test = 1;
  if (multipleTest) {
    cin >> Test;
  }
  for (int i = 0; i < Test; ++i) {
    solve();
  }
}
