#include <bits/stdc++.h>
const int MAXN = 5e3 + 7;
const int INF = 5e8;
const int SQR = 75;
int f[MAXN][SQR][2 * SQR];
int a[MAXN], pre[MAXN], suc[MAXN];
int n;
int dfs(int l, int dif, int k) {
  if (f[l][dif][k] < INF) return f[l][dif][k];
  int &ret = f[l][dif][k];
  if (l + l + dif + k - SQR > n) {
    ret = pre[l] - suc[l + dif - SQR];
    return ret;
  }
  ret = INT_MIN;
  for (int i = k; i <= k + 1; i++) {
    if (l + l + dif + i - SQR > n) continue;
    int num = INF;
    for (int j = i; j <= i + 1; j++) {
      if (l + l + dif + i + j - SQR <= n)
        num = std::min(num, dfs(l + i, dif + j - i, j));
    }
    if (num == INF) num = pre[l + i] - suc[l + dif - SQR];
    ret = std::max(ret, num);
  }
  return ret;
}
int main(int argc, char *argv[]) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    pre[i] = pre[i - 1] + a[i];
  }
  for (int i = n; i; i--) suc[n - i + 1] = suc[n - i] + a[i];
  memset(f, 0x3f, sizeof f);
  printf("%d\n", dfs(0, SQR, 1));
  return 0;
}
