#include <bits/stdc++.h>
using namespace std;
const int MAX = 4005;
int N, A[MAX], dp[MAX][MAX][2];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", A + i);
    A[i] += A[i - 1];
  }
  for (int k = 100; k >= 1; --k) {
    for (int left = N; left >= 0; --left) {
      for (int right = min(N, left + k); right >= max(0, left - k); --right) {
        int &cur = dp[left][right][k % 2];
        int turn = left > right;
        int gap = N - (left + right);
        if (gap < k) continue;
        if (turn == 0) {
          cur = A[left + k] - A[left] + dp[left + k][right][k % 2];
          if (gap >= k + 1)
            cur = max(cur, A[left + k + 1] - A[left] +
                               dp[left + k + 1][right][(k + 1) % 2]);
        } else {
          cur = -(A[N - right] - A[N - right - k]) + dp[left][right + k][k % 2];
          if (gap >= k + 1)
            cur = min(cur, -(A[N - right] - A[N - right - k - 1]) +
                               dp[left][right + k + 1][(k + 1) % 2]);
        }
      }
    }
  }
  printf("%d\n", dp[0][0][1]);
  return 0;
}
