#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
long long a[N], ltor[N], rtol[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  memset(ltor, 0, sizeof(ltor));
  memset(rtol, 0, sizeof(rtol));
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    ltor[i] = ltor[i - 1] + a[i];
  }
  for (int i = n; i >= 1; i--) {
    rtol[i] = rtol[i + 1] + a[i];
  }
  int i = 1, j = n;
  long long ans = 0;
  while (i < j) {
    if (ltor[i] == rtol[j]) {
      ans = max(ans, ltor[i]);
      i++, j--;
    } else {
      if (ltor[i] > rtol[j])
        j--;
      else
        i++;
    }
  }
  cout << ans << endl;
  return 0;
}
