#include <bits/stdc++.h>
using namespace std;
const int N = 4000 + 5, SQ = 65 + 5, INF = 1e9 + 5;
int n, a[N], dp[N][SQ][SQ];
void readInput() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
    a[i + 1] += a[i];
  }
}
void solve() {
  for (int i = n - 1; ~i; i--)
    for (int j = 0; j < SQ; j++)
      for (int k = 1; k < SQ; k++) {
        int l = i, r = n - i - j;
        if (l >= r) break;
        dp[i][j][k] = -INF;
        for (auto x : {k, k + 1})
          if (r - l >= x) {
            int s1 = 0, s2 = 0;
            for (auto y : {x, x + 1}) {
              s1 = (l + x <= r - y ? dp[l + x][n - l - x - r + y][y] +
                                         a[l + x] - a[l] - a[r] + a[r - y]
                                   : INF);
              swap(s1, s2);
            }
            dp[i][j][k] = max(dp[i][j][k], min(s1, s2) == INF ? a[l + x] - a[l]
                                                              : min(s1, s2));
          }
        dp[i][j][k] *= (dp[i][j][k] != -INF);
      }
}
void writeOutput() { cout << dp[0][0][1] << endl; }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  readInput(), solve(), writeOutput();
  return 0;
}
