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