#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long arr[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  set<long long> ans;
  int l = 1, r = n;
  long long sum1 = 0, sum3 = 0;
  while (l <= r) {
    if (sum1 == sum3) {
      ans.insert(sum1);
      if (l == r) {
        break;
      }
      sum1 += arr[l];
      l++;
      sum3 += arr[r];
      r--;
    } else if (sum1 < sum3) {
      sum1 += arr[l];
      l++;
    } else {
      sum3 += arr[r];
      r--;
    }
  }
  if (sum1 == sum3) {
    ans.insert(sum1);
  }
  cout << *(ans.rbegin());
}
