#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int a[n], lv = 0;
  cin >> a[0];
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  int i = 0, j = n - 2;
  while (i <= j) {
    if (a[i] < (a[n - 1] - a[j])) {
      i++;
    } else if (a[i] > (a[n - 1] - a[j])) {
      j--;
    } else {
      lv = a[i];
      i++;
      j--;
    }
  }
  cout << lv;
  return 0;
}
