#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int sbegin = a[0], send = a[n - 1];
  long long int res = 0;
  for (long long int i = 0, j = n - 1; i < j;) {
    if (sbegin > send) {
      j--;
      send += a[j];
    } else if (sbegin < send) {
      i++;
      sbegin += a[i];
    } else if (sbegin == send) {
      res = max(res, sbegin);
      i++, j--;
      send += a[j];
      sbegin += a[i];
    }
  }
  cout << res << endl;
}
