#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> v, v1;
  map<long long, long long> fuck;
  long long n, i, j, temp = 0, x;
  cin >> n;
  for (i = 0; i < n; i += 1) {
    cin >> x;
    v.push_back(x);
    v1.push_back(x);
  }
  reverse(v.begin(), v.end());
  long long a[n], b[n];
  a[0] = v[0];
  b[0] = v1[0];
  for (i = 1; i < n; i += 1) {
    a[i] = a[i - 1] + v[i];
    b[i] = b[i - 1] + v1[i];
  }
  i = j = 0;
  while (i + j < n - 1) {
    if (a[i] < b[j])
      i += 1;
    else {
      if (a[i] > b[j])
        j += 1;
      else {
        temp = a[i];
        i += 1;
        j += 1;
      }
    }
  }
  cout << temp << endl;
}
