#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9, MAXN = 4010;
int n;
inline int pack(int l, int r, int k) { return (l << 19) + (r << 7) + k; }
unordered_map<int, int> dp(MAXN* MAXN * 2);
vector<int> a, pref;
int calc(int l, int r, int k, int p) {
  if (p) {
    if (dp.count(pack(l, r, k))) return dp[pack(l, r, k)];
    if (r - l + 1 < k) return dp[pack(l, r, k)] = 0;
    if (r - l + 1 == k)
      return dp[pack(l, r, k)] =
                 (calc(l + k, r, k, p ^ 1) + (pref[l + k - 1] - pref[l - 1]));
    return dp[pack(l, r, k)] = max(
               calc(l + k, r, k, p ^ 1) + (pref[l + k - 1] - pref[l - 1]),
               calc(l + k + 1, r, k + 1, p ^ 1) + (pref[l + k] - pref[l - 1]));
  }
  if (r - l + 1 < k) return 0;
  if (r - l + 1 == k) return calc(l, r - k, k, p ^ 1) - (pref[r] - pref[r - k]);
  return min(calc(l, r - k, k, p ^ 1) - (pref[r] - pref[r - k]),
             calc(l, r - k - 1, k + 1, p ^ 1) - (pref[r] - pref[r - k - 1]));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n;
  a.resize(n);
  pref.resize(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pref[i + 1] = pref[i] + a[i];
  }
  cout << calc(1, n, 1, 1) << '\n';
  return 0;
}
