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