#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int l1[n];
  long long int l2[n];
  l1[0] = a[0];
  l2[n - 1] = a[n - 1];
  for (int i = 1; i < n; i++) l1[i] = l1[i - 1] + a[i];
  for (int i = n - 2; i >= 0; i--) l2[i] = l2[i + 1] + a[i];
  sort(l2, l2 + n);
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    auto t = lower_bound(l2, l2 + n, l1[i]) - l2;
    if (l2[t] == l1[i] && t + i < n - 1) {
      ans = l1[i];
    }
  }
  cout << ans << endl;
}
