#include <bits/stdc++.h>
using namespace std;
int dp[4005][67][67];
int a[4005], sl[4005], sr[4005];
void upd(int &x, int y) {
  if (x < y) x = y;
}
int main() {
  int n, i, j, l, k, mn1, mn2, mn3, mn4, t, ti;
  cin >> n;
  for (i = 1; i <= n; i++)
    for (k = 1; k < 67; k++)
      for (l = 0; l < 67; l++) dp[i][k][l] = -1000000000;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sl[i] = sl[i - 1] + a[i];
  }
  for (i = n; i; i--) sr[i] = sr[i + 1] + a[i];
  for (i = n / 2; i >= 0; i--) {
    for (k = 1; k < 67; k++)
      for (l = 0; l < k; l++) {
        j = n - (i + l) + 1;
        if (i >= j) dp[i][k][l] = -1000000000;
        if (j - i - 1 < k)
          dp[i][k][l] = sl[i] - sr[j];
        else {
          t = j - i - 1;
          ti = i + k;
          if (ti < j) {
            if (t >= k + k)
              mn1 = dp[i + k][k][l];
            else
              mn1 = sl[i + k] - sr[j];
            if (t >= k + k + 1)
              mn2 = dp[i + k][k + 1][l + 1];
            else
              mn2 = mn1;
          }
          ti++;
          if (ti < j) {
            if (t >= k + 1 + k + 1)
              mn3 = dp[i + k + 1][k + 1][l];
            else
              mn3 = sl[i + k + 1] - sr[j];
            if (t >= k + 1 + k + 2)
              mn4 = dp[i + k + 1][k + 2][l + 1];
            else
              mn4 = mn3;
          } else
            mn3 = mn4 = -1000000000;
          dp[i][k][l] = max(min(mn1, mn2), min(mn3, mn4));
        }
      }
  }
  cout << dp[0][1][0] << endl;
  return 0;
}
