#include <bits/stdc++.h>
const long long gig = 1e9;
using namespace std;
long long binpow(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans *= a;
    a *= a;
    n >>= 1;
  }
  return ans;
}
long long a[211111];
map<long long, long long> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, k;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  k = 0;
  for (int i = n; i >= 1; i--) {
    k += a[i];
    mp[k] = i;
  }
  k = 0;
  long long ot = 0;
  for (int i = 1; i <= n; i++) {
    k += a[i];
    if (mp[k] > i) ot = k;
  }
  cout << ot << "\n";
}
