#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j;
  cin >> n;
  long long int a[n];
  vector<long long int> v;
  for (i = 0; i < n; i++) cin >> a[i];
  long long int suml = 0, sumr = 0;
  for (i = -1, j = n; i < j;) {
    if (suml == sumr) {
      v.push_back(suml);
      i++;
      suml += a[i];
    } else if (suml < sumr) {
      i++;
      suml += a[i];
    } else {
      j--;
      sumr += a[j];
    }
  }
  long long int ans = *max_element(v.begin(), v.end());
  cout << ans << endl;
  return 0;
}
