#include <bits/stdc++.h>
using namespace std;
int n;
int a[(int)(2 * 1e5 + 10)];
long long pa[(int)(2 * 1e5 + 10)];
long long sa[(int)(2 * 1e5 + 10)];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    pa[i] = 1ll * a[i] + pa[i - 1];
  }
  for (int i = n; i >= 1; --i) {
    sa[i] = 1ll * a[i] + sa[i + 1];
  }
  int x = n;
  long long mx = 0;
  int i = 1;
  while (i <= n) {
    if (i < x) {
      if (pa[i] > sa[x])
        --x;
      else if (pa[i] < sa[x])
        ++i;
      else
        mx = max(mx, pa[i]), ++i, --x;
    } else
      break;
  }
  cout << mx << endl;
}
