#include <bits/stdc++.h>
using namespace std;
int arr[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int i = -1, j = n;
  long long int ans = 0, sumi = 0, sumj = 0;
  while (i < j) {
    if (sumi == sumj) {
      if (sumi > ans) ans = sumi;
      i++;
      j--;
      sumi += arr[i];
      sumj += arr[j];
    } else if (sumi > sumj) {
      j--;
      sumj += arr[j];
    } else {
      i++;
      sumi += arr[i];
    }
  }
  cout << ans;
}
