#include <bits/stdc++.h>
using namespace std;
int64_t pre[200001];
bool seen[2][200001];
int64_t dp[2][200001];
int n;
int64_t solve(int turn, int rem) {
  if (rem == 0) return 0;
  if (seen[turn][rem]) return dp[turn][rem];
  seen[turn][rem] = 1;
  int l = n - rem;
  int64_t bst = pre[n];
  bst = max(bst, (rem == 1 ? pre[n] : 0) + solve(turn, rem - 1));
  int k = 1 + (rem == n);
  bst = max(bst, pre[l + k] - solve(turn ^ 1, rem - k));
  return dp[turn][rem] = bst;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> pre[i];
    pre[i] += pre[i - 1];
  }
  cout << solve(0, n) << '\n';
  return 0;
}
