#include <bits/stdc++.h>
using namespace std;
void ga(int N, int *A) {
  for (int i(0); i < N; i++) scanf("%d", A + i);
}
unordered_map<int, int> dp;
int N, S[(4000)];
int dyn(int a, int b, int K, bool x) {
  if (b - a + 1 < K) return 0;
  if (b - a + 1 == K) return (S[b] - (a ? S[a - 1] : 0));
  if (dp.count(
          (a + (4000) * b + (4000) * (4000) * K + x * (4000) * (4000) * 100)))
    return dp[(a + (4000) * b + (4000) * (4000) * K +
               x * (4000) * (4000) * 100)];
  if (!x)
    return dp[(a + (4000) * b + (4000) * (4000) * K +
               x * (4000) * (4000) * 100)] =
               max(-dyn(a + K, b, K, 1) + (S[a + K - 1] - (a ? S[a - 1] : 0)),
                   -dyn(a + K + 1, b, K + 1, 1) +
                       (S[a + K] - (a ? S[a - 1] : 0)));
  return dp[(a + (4000) * b + (4000) * (4000) * K +
             x * (4000) * (4000) * 100)] =
             max(-dyn(a, b - K, K, 0) +
                     (S[b] - (b - K + 1 ? S[b - K + 1 - 1] : 0)),
                 -dyn(a, b - K - 1, K + 1, 0) +
                     (S[b] - (b - K ? S[b - K - 1] : 0)));
}
int main(void) {
  dp.max_load_factor(.4);
  scanf("%d", &N), ga(N, S);
  for (int k(1); k < N; k++) S[k] += S[k - 1];
  printf("%d\n", dyn(0, N - 1, 1, 0));
  return 0;
}
