#include <bits/stdc++.h>
using namespace std;
int v[200001];
long long vals[200001];
int main() {
  int n;
  cin >> n;
  long long s = 0;
  long long maxs = 0;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    vals[i] = vals[i - 1] + v[i];
  }
  long long ind = 1;
  for (int i = n; i >= 1; i--) {
    s += v[i];
    while (ind < i) {
      if (vals[ind] == s) {
        maxs = s;
      }
      if (vals[ind] > s) break;
      ind++;
    }
  }
  cout << maxs;
}
