#include <bits/stdc++.h>
long long n, i, res;
using namespace std;
int main() {
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  int l = 0, r = n - 1;
  long long suma = 0, sumb = 0;
  while (l <= r) {
    if (suma < sumb) {
      suma += a[l];
      l++;
    } else {
      if (suma == sumb) {
        res = max(res, suma);
        suma += a[l];
        l++;
      } else {
        sumb += a[r];
        r--;
      }
    }
  }
  if (suma == sumb) res = max(res, suma);
  cout << res;
  return 0;
}
