#include <bits/stdc++.h>
using namespace std;
void GO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
const long long INF = 1e9 + 7;
const long long mod = (1e9);
const int maxn = (int)4000;
const long double PI = acos(-1.0);
const long double eps = 0.000000001;
mt19937 rnd(time(0));
int dp[maxn][90][90];
int a[maxn], pref[maxn];
int n;
int get_pref(int l, int r) { return pref[r] - (!l ? 0 : pref[l - 1]); }
int get_ans(int l, int d, int k) {
  int r = n - (l + d) - 1;
  if (r - l + 1 < k || l > r) return 0;
  if (r - l + 1 < 2 * k) {
    if (r - l + 1 >= k + 1)
      return max(get_pref(l, l + k - 1), get_pref(l, l + k));
    else
      return get_pref(l, l + k - 1);
  }
  if (dp[l][d][k] != INF) return dp[l][d][k];
  int one = get_pref(l, l + k - 1);
  int two = get_pref(r - k + 1, r);
  int lol1 = one - two + get_ans(l + k, d, k);
  int lol2 = lol1;
  two = get_pref(r - k, r);
  if (r - l + 1 >= 2 * k + 1) lol2 = one - two + get_ans(l + k, d + 1, k + 1);
  dp[l][d][k] = min(lol1, lol2);
  one = get_pref(l, l + k);
  two = get_pref(r - k, r);
  lol1 = one;
  if (r - l + 1 >= 2 * k + 2) lol1 = one - two + get_ans(l + k + 1, d, k + 1);
  lol2 = lol1;
  two = get_pref(r - k - 1, r);
  if (r - l + 1 >= 2 * k + 3)
    lol2 = one - two + get_ans(l + k + 1, d + 1, k + 2);
  dp[l][d][k] = max(dp[l][d][k], min(lol1, lol2));
  return dp[l][d][k];
}
void solve() {
  cin >> n;
  for (int i = 0; i < maxn; ++i)
    for (int j = 0; j < 90; ++j)
      for (int k = 0; k < 90; ++k) dp[i][j][k] = INF;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) pref[i] = (i ? pref[i - 1] : 0) + a[i];
  cout << get_ans(0, 0, 1);
}
signed main() {
  GO();
  int Q = 1;
  while (Q--) {
    solve();
  }
}
