#include <bits/stdc++.h>
using namespace std;
const int MAXSIZE = 1000020;
const int INF = 0x3f3f3f3f;
int bufpos;
char buf[MAXSIZE];
void init() {
  buf[fread(buf, 1, MAXSIZE, stdin)] = '\0';
  bufpos = 0;
}
int readint() {
  bool isneg;
  int val = 0;
  for (; !isdigit(buf[bufpos]) && buf[bufpos] != '-'; bufpos++)
    ;
  bufpos += (isneg = buf[bufpos] == '-');
  for (; isdigit(buf[bufpos]); bufpos++) val = val * 10 + buf[bufpos] - '0';
  return isneg ? -val : val;
}
char readchar() {
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  return buf[bufpos++];
}
int readstr(char* s) {
  int cur = 0;
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  for (; !isspace(buf[bufpos]); bufpos++) s[cur++] = buf[bufpos];
  s[cur] = '\0';
  return cur;
}
int a[4003];
int dp[2003][185][95][2];
int n;
int dfs(int l, int r, int x, bool who) {
  if (r - l + 1 < x) return 0;
  if (r - l + 1 == x) return a[r] - a[l - 1];
  int& res = dp[l][r - n + l + 92][x][who];
  if (res != INF) return res;
  if (who)
    res = max(a[r] - a[r - x] - dfs(l, r - x, x, 0),
              a[r] - a[r - x - 1] - dfs(l, r - x - 1, x + 1, 0));
  else
    res = max(a[l + x - 1] - a[l - 1] - dfs(l + x, r, x, 1),
              a[l + x] - a[l - 1] - dfs(l + x + 1, r, x + 1, 1));
  return res;
}
int main() {
  init();
  n = readint();
  for (int i = 1; i <= n; i++) a[i] = readint() + a[i - 1];
  memset(dp, 0x3f, sizeof(dp));
  int ans = dfs(1, n, 1, 0);
  printf("%d", ans);
}
