#include <bits/stdc++.h>
using namespace std;
const int MX = 1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  long long lSum, rSum;
  vector<int> elems;
  for (int i = 0; i < n; i++) {
    int elem;
    cin >> elem;
    elems.push_back(elem);
    ;
  }
  int l = 0;
  int r = n - 1;
  lSum = elems[l];
  rSum = elems[r];
  long long max = 0;
  while ((r - l) >= 1) {
    if (rSum > lSum) {
      l++;
      lSum += elems[l];
    } else if (lSum > rSum) {
      r--;
      rSum += elems[r];
    } else {
      max = lSum;
      l++;
      lSum += elems[l];
    }
  }
  cout << max << endl;
}
