#include <bits/stdc++.h>
using namespace std;
long long mod = 29999999;
int sum[10000], f[30000000], n, ans, boo[30000000];
int mima(int bo, int x, int y) { return bo * max(x * bo, y * bo); }
int dp(int l, int r, int k, int bo) {
  if (l + k - 1 > r) return 0;
  if (l + k - 1 == r) return bo * (sum[r] - sum[l - 1]);
  long long hash = (l * 18000 + r * 250 + k * 4 + bo) % mod;
  if (boo[hash]) return f[hash];
  int ans = 0;
  if (bo > 0) {
    ans = dp(l + k, r, k, -bo) + bo * (sum[l + k - 1] - sum[l - 1]);
    ans = mima(bo, ans,
               dp(l + k + 1, r, k + 1, -bo) + bo * (sum[l + k] - sum[l - 1]));
  } else {
    ans = dp(l, r - k, k, -bo) + bo * (sum[r] - sum[r - k]);
    ans = mima(bo, ans,
               dp(l, r - k - 1, k + 1, -bo) + bo * (sum[r] - sum[r - k - 1]));
  }
  f[hash] = ans;
  boo[hash] = 1;
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    sum[i] = sum[i - 1] + x;
  }
  ans = dp(1, n, 1, 1);
  printf("%d", ans);
}
