#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, sum1 = 0, sum2 = 0, sumx = 0;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int i = 0, j = n - 1;
  sum1 = arr[i];
  sum2 = arr[j];
  while (i != j) {
    if (sum1 == sum2) {
      if (sum1 > sumx) {
        sumx = sum1;
      }
      if (j - 1 > i + 1) {
        sum1 += arr[i + 1];
        sum2 += arr[j - 1];
        i++;
        j--;
        continue;
      } else
        break;
    } else if (sum1 > sum2) {
      if (j - 1 > i) {
        sum2 += arr[j - 1];
        j--;
        continue;
      } else
        break;
    } else if (sum1 < sum2) {
      if (j > i + 1) {
        sum1 += arr[i + 1];
        i++;
        continue;
      } else
        break;
    }
  }
  cout << sumx;
  return 0;
}
