#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, max_sum = 0;
  long long int Rsum = 0, Lsum = 0;
  int arr[200004];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int j = n;
  int i = 1;
  Rsum = arr[i];
  Lsum = arr[j];
  while (1) {
    if (i < j) {
      if (Rsum < Lsum) {
        Rsum = Rsum + arr[i + 1];
        i++;
      } else if (Rsum > Lsum) {
        Lsum = Lsum + arr[j - 1];
        j--;
      } else {
        max_sum = Rsum;
        Rsum = Rsum + arr[i + 1];
        Lsum = Lsum + arr[j - 1];
        i++;
        j--;
      }
    } else
      break;
  }
  cout << max_sum << endl;
}
