#include <bits/stdc++.h>
using namespace std;
const int N = 100100, M = 64810000, S = 90, oo = 1000000000;
int i, j, k, n, m, ch, ff;
int s[N];
int F[M];
void R(int &x) {
  ff = x = 0;
  while (ch < '0' || '9' < ch) {
    if (ch == '-') ff = 1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  if (ff) x = -x;
}
int P(int l, int r, int k) {
  int t = 0;
  l--;
  r--;
  k--;
  t = (l * S * 2 + n - r - l + S) * S + k;
  return t;
}
int min(const int &x, const int &y) {
  if (x < y) return x;
  return y;
}
int max(const int &x, const int &y) {
  if (x > y) return x;
  return y;
}
int f(int l, int r, int k, int o) {
  if (r - l + 1 < k) return 0;
  if (o == 1) {
    int ans = f(l, r - k, k, 0) - s[r] + s[r - k];
    if (r - l + 1 >= k + 1)
      ans = min(ans, f(l, r - k - 1, k + 1, 0) - s[r] + s[r - k - 1]);
    return ans;
  } else {
    int t = P(l, r, k);
    if (F[t] < oo) return F[t];
    int ans;
    ans = s[l + k - 1] - s[l - 1] + f(l + k, r, k, 1);
    if (r - l + 1 >= k + 1)
      ans = max(ans, s[l + k] - s[l - 1] + f(l + k + 1, r, k + 1, 1));
    return F[t] = ans;
  }
}
int main() {
  memset(F, 60, sizeof F);
  R(n);
  for (i = 1; i <= n; i++) R(s[i]), s[i] += s[i - 1];
  printf("%d\n", f(1, n, 1, 0));
}
