#include <bits/stdc++.h>
using namespace std;
bool find(long long x, long long suml[], int l, int r) {
  while (l <= r) {
    int m = l + (r - l) / 2;
    if (suml[m] == x)
      return true;
    else if (suml[m] > x)
      l = m + 1;
    else
      r = m - 1;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long sumf[n];
  long long suml[n];
  sumf[0] = arr[0];
  suml[n - 1] = arr[n - 1];
  for (int i = 1; i < n; i++) {
    sumf[i] = arr[i] + sumf[i - 1];
  }
  for (int i = n - 2; i >= 0; i--) {
    suml[i] = suml[i + 1] + arr[i];
  }
  long long max = 0;
  for (int i = 0; i < n - 1; i++) {
    if (sumf[i] > max && find(sumf[i], suml, i + 1, n - 1)) max = sumf[i];
  }
  cout << max << endl;
}
