#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 int s1 = 0, s2 = 0, ans = 0;
  int i = 0, j = n - 1;
  s1 = a[0];
  s2 = a[n - 1];
  while (j > i) {
    if (s1 == s2) {
      ans = s1;
      i++;
      j--;
      s1 += a[i];
      s2 += a[j];
    } else if (s1 > s2) {
      j--;
      s2 += a[j];
    } else {
      i++;
      s1 += a[i];
    }
  }
  cout << ans;
}
