#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i;
  long long n;
  cin >> n;
  long long p[n], s[n];
  for (i = 0; i < n; i++) {
    cin >> p[i];
    s[n - i - 1] = p[i];
  }
  for (i = 1; i < n; i++) {
    p[i] += p[i - 1];
    s[i] += s[i - 1];
  }
  long long mx = 0;
  for (i = n - 1; i >= 0; i--) {
    long l = 0;
    bool mark = false;
    long r = n - 1;
    while (l <= r) {
      int mid = l + (r - l) / 2;
      if (p[i] == s[mid] && (i + mid) < n - 1) {
        mx = p[i];
        i = 0;
        break;
      } else if (p[i] < s[mid])
        r = mid - 1;
      else
        l = mid + 1;
    }
  }
  cout << mx << "\n";
}
