#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9 + 7;
const long long linf = 1e18 + 7;
long long a[200007];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int i = 0, j = n - 1;
  long long ans = 0;
  long long s1 = 0, s2 = 0;
  while (i <= j) {
    s1 += a[i];
    i++;
    if (s1 == s2) {
      ans = max(ans, s1);
    }
    if (i > j) {
      break;
    }
    while (i <= j && s2 < s1) {
      s2 += a[j];
      j--;
    }
    if (s1 == s2) {
      ans = max(ans, s1);
    }
  }
  cout << ans << endl;
  return 0;
}
