#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long d[n];
  for (int j = 0; j < n; j++) cin >> d[j];
  long long A[n], B[n];
  A[0] = d[0];
  for (int j = 1; j < n; j++) A[j] = d[j] + A[j - 1];
  B[0] = d[n - 1];
  for (int j = 1; j < n; j++) B[j] = d[n - 1 - j] + B[j - 1];
  long long sum = 0, sum1 = 0, sum2 = A[n - 1];
  for (int j = 0; j < n; j++) {
    if ((binary_search(B, B + n - j - 1, A[j]))) {
      sum = A[j];
    }
  }
  cout << sum;
  return 0;
}
