#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  T x = 0, f = 1;
  int c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + (c & 15), c = getchar();
  return x * f;
}
long long sum[4005];
long long dp[30000007];
int n;
long long dfs(int i, int j, long long k, int turn) {
  long long state = (turn + 2 * (k + 100 * (j + (4000ll * i)))) % 29999999;
  if (~dp[state]) return dp[state];
  long long ans = 0;
  if (turn == 0) {
    if (i + k < j) ans = dfs(i + k, j, k, 1) + sum[i + k] - sum[i];
    if (i + k + 1 < j)
      ans = max(ans, dfs(i + k + 1, j, k + 1, 1) + sum[i + k + 1] - sum[i]);
  } else {
    if (j - k > i) ans = dfs(i, j - k, k, 0) - sum[j - 1] + sum[j - k - 1];
    if (j - k - 1 > i)
      ans = min(ans, dfs(i, j - k - 1, k + 1, 0) - sum[j - 1] + sum[j - k - 2]);
  }
  dp[state] = ans;
  return dp[state];
}
int main() {
  n = read<int>();
  for (int i = 1; i <= n; ++i) {
    sum[i] = read<long long>();
    sum[i] += sum[i - 1];
  }
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", dfs(0, n + 1, 1, 0));
  return 0;
}
