#include <bits/stdc++.h>
using namespace std;
const long long N = 200011;
long long A[N];
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
  long long l = 0;
  long long r = n - 1;
  long long mx = 0;
  long long suml = A[0];
  long long sumr = A[n - 1];
  while (l < r) {
    if (suml == sumr) {
      mx = max(mx, suml);
      l++;
      suml += A[l];
      r--;
      sumr += A[r];
    } else if (suml < sumr) {
      l++;
      suml += A[l];
    } else {
      r--;
      sumr += A[r];
    }
  }
  cout << mx << endl;
  return 0;
}
