#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
void write(int x) {
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
long long base = 1e9 + 7;
int n;
int a[4006], sum[4006];
int f[4006][91][91][2];
void ReadInPut() {
  n = read();
  for (int i = (int)1; i <= (int)n; i++) {
    a[i] = read();
    sum[i] = sum[i - 1] + a[i];
  }
}
int tinh(int l, int d, int k, int t) {
  int sl = -1;
  if (t == 0) sl = 1;
  if (n - (2 * (l - 1) + sl * d) < k) return 0;
  if (f[l][d][k][t] != -1) return f[l][d][k][t];
  int res = 0;
  if (t == 0) {
    res = tinh(l + k, k - d, k, 1) + sum[l + k - 1] - sum[l - 1];
    if (n - (2 * (l - 1) + sl * d) >= k + 1) {
      if (res <
          (tinh(l + k + 1, k - d + 1, k + 1, 1) + sum[l + k] - sum[l - 1]))
        res = (tinh(l + k + 1, k - d + 1, k + 1, 1) + sum[l + k] - sum[l - 1]);
    }
  } else {
    int pos = n - (l - 1 - d);
    res = tinh(l, k - d, k, 0) - sum[pos] + sum[pos - k];
    if (n - (2 * (l - 1) + sl * d) >= k + 1) {
      if (res > (tinh(l, k - d + 1, k + 1, 0) - sum[pos] + sum[pos - k - 1]))
        res = (tinh(l, k - d + 1, k + 1, 0) - sum[pos] + sum[pos - k - 1]);
    }
  }
  f[l][d][k][t] = res;
  return res;
}
void Solve() {
  memset(f, -1, sizeof(f));
  cout << tinh(1, 0, 1, 0);
}
int main() {
  int sotest = 1;
  for (int i = 1; i <= sotest; i++) {
    ReadInPut();
    Solve();
  }
}
