#include <bits/stdc++.h>
using namespace std;
const int N = 200018;
int arr[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<long long, int> mp;
  long long sum1 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i], sum1 += arr[i];
    mp[sum1] = i;
  }
  long long sum3 = 0, ans = 0;
  for (int i = n; i >= 1; i--) {
    sum3 += arr[i];
    if (mp[sum3] && mp[sum3] < i) {
      ans = sum3;
    }
  }
  cout << ans;
}
