#include <bits/stdc++.h>
using namespace std;
int bs(vector<long long int> &v, int l, int r, long long int key) {
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (v[mid] == key) return 1;
    if (v[mid] < key)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long int s = 0, ans = 0;
  long long int d[n];
  for (int i = 0; i < n; i++) cin >> d[i];
  vector<long long int> v;
  v.push_back(d[n - 1]);
  for (int i = n - 2; i >= 0; i--) {
    v.push_back(d[i] + v.back());
  }
  for (int i = 0; i < n - 1; i++) {
    s += d[i];
    if (bs(v, 0, n - i - 2, s)) {
      ans = s;
    }
  }
  cout << ans << endl;
}
