#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, ans = 0;
  cin >> n;
  vector<long long> num(n);
  for (int i = 0; i < n; i++) {
    cin >> num[i];
  }
  int a = 0, b = n - 1;
  long long fsum = 0, bsum = 0;
  while (a <= b) {
    if (fsum >= bsum) {
      bsum += num[b];
      b--;
    } else {
      fsum += num[a];
      a++;
    }
    if (fsum == bsum) ans = max(ans, fsum);
  }
  cout << ans;
}
