#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e7 + 10;
const int mod = 29999997;
long long dp[maxn];
long long sum[4010];
int a[4010];
int n;
long long dfs(int l, int r, int k, bool x) {
  if (r - l + 1 < k) return 0;
  long long sta = ((((l * 4000ll) + r) * 100 + k) * 2 + x) % mod;
  if (dp[sta] != -1) {
    return dp[sta];
  }
  long long ans = 0;
  if (x) {
    ans = dfs(l, r - k, k, 0) - (sum[r] - sum[r - k]);
    if (l <= r - k) {
      ans = min(ans, dfs(l, r - k - 1, k + 1, 0) - (sum[r] - sum[r - k - 1]));
    }
  } else {
    ans = dfs(l + k, r, k, 1) + (sum[l + k - 1] - sum[l - 1]);
    if (l + k <= r) {
      ans = max(ans, dfs(l + k + 1, r, k + 1, 1) + (sum[l + k] - sum[l - 1]));
    }
  }
  return dp[sta] = ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = 1ll * sum[i - 1] + a[i];
  }
  int ans = dfs(1, n, 1, 0);
  cout << ans << endl;
  return 0;
}
