#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long INF = 1e18;
const int N = 2001;
int dp[N][105][105];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<int> pre(n + 1);
  for (int i = 0; i < n; i++) pre[i + 1] = pre[i] + v[i];
  for (int i = n / 2; i >= 0; i--) {
    for (int d = 0; d < 100; d++) {
      for (int k = 1; k < 100; k++) {
        if (d > k) continue;
        if (2 * i + d + k > n) continue;
        if (2 * i + d + k + k > n) {
          dp[i][d][k] = pre[i + k] - pre[i];
        } else {
          if (2 * i + d + k + k + 1 > n)
            dp[i][d][k] =
                pre[i + k] - pre[i] - (pre[n - i - d] - pre[n - i - d - k]);
          else
            dp[i][d][k] = min(dp[i + k][d][k] + pre[i + k] - pre[i] -
                                  pre[n - i - d] + pre[n - i - d - k],
                              dp[i + k][d + 1][k + 1] + pre[i + k] - pre[i] -
                                  pre[n - i - d] + pre[n - i - d - k - 1]);
        }
        if (2 * i + d + k + 1 > n) continue;
        if (2 * i + d + k + 1 + k + 1 > n) {
          dp[i][d][k] = max(dp[i][d][k], pre[i + k + 1] - pre[i]);
        } else {
          if (2 * i + d + k + 1 + k + 2 > n)
            dp[i][d][k] = max(
                dp[i][d][k], dp[i + k + 1][d][k + 1] + pre[i + k + 1] - pre[i] -
                                 pre[n - i - d] + pre[n - i - d - k - 1]);
          else
            dp[i][d][k] =
                max(dp[i][d][k],
                    min(dp[i + k + 1][d][k + 1] + pre[i + k + 1] - pre[i] -
                            pre[n - i - d] + pre[n - i - d - k - 1],
                        dp[i + k + 1][d + 1][k + 2] + pre[i + k + 1] - pre[i] -
                            pre[n - i - d] + pre[n - i - d - k - 2]));
        }
      }
    }
  }
  cout << dp[0][0][1] << "\n";
  return 0;
}
