#include <bits/stdc++.h>
using namespace std;
const int N = 4e3 + 5;
const int M = 65;
int n, A[N];
int dp_l[N][M][M], dp_r[N][M][M];
int solve_r(int l, int sz, int k);
int solve_l(int l, int sz, int k) {
  if (sz < k) return 0;
  if (~dp_l[l][sz][k]) return dp_l[l][sz][k];
  int now = solve_r(l + k, sz - k, k) + A[l + k - 1] - A[l - 1];
  if (sz >= k + 1)
    now = max(now, solve_r(l + k + 1, sz - k - 1, k + 1) + A[l + k] - A[l - 1]);
  return dp_l[l][sz][k] = now;
}
int solve_r(int l, int sz, int k) {
  if (sz < k) return 0;
  if (~dp_r[l][sz][k]) return dp_r[l][sz][k];
  int r = l + sz - 1;
  int now = solve_l(l, sz - k, k) - A[r] + A[r - k];
  if (sz >= k + 1)
    now = min(now, solve_l(l, sz - k - 1, k + 1) - A[r] + A[r - k - 1]);
  return dp_r[l][sz][k] = now;
}
int main() {
  memset(dp_l, -1, sizeof dp_l), memset(dp_r, -1, sizeof dp_r);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", A + i);
    A[i] += A[i - 1];
  }
  printf("%d\n", solve_l(1, n, 1));
  return 0;
}
