#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int a = 0, b = n - 1;
  long long s1 = v[a], s2 = v[b], rta = 0;
  while (b > a) {
    if (s1 == s2) {
      rta = s1;
      b--;
      s2 += v[b];
    } else if (s1 > s2) {
      b--;
      s2 += v[b];
    } else {
      a++;
      s1 += v[a];
    }
  }
  cout << rta << endl;
  return 0;
}
