#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long ara[200009 + 10];
long long arb[200009 + 10];
long long BS(long long src) {
  long long lo = 0, hi = n;
  while (lo < hi) {
    long long mid = lo + (hi - lo) / 2;
    if (ara[mid] > src)
      hi = mid;
    else
      lo = mid + 1;
  }
  return lo;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie();
  cin >> n;
  long long arr[n];
  long long sum1[n], sum2[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sum1[0] = arr[0];
  for (int i = 1; i <= n - 1; i++) sum1[i] = arr[i] + sum1[i - 1];
  sum2[n - 1] = arr[n - 1];
  for (long long i = n - 2; i >= 0; i--) sum2[i] = sum2[i + 1] + arr[i];
  long long ans = 0;
  reverse(sum2, sum2 + n);
  for (int i = 0; i < n; i++) {
  }
  for (int i = 0; i < n; i++) {
    if (binary_search(sum2, sum2 + n - i - 1, sum1[i])) ans = sum1[i];
  }
  cout << ans << endl;
}
