#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int n, i, j;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  long long sum_l = 0, sum_r = 0, res = 0;
  for (i = 1, j = n + 1; i < j; i++) {
    sum_l += a[i];
    while (i < j && sum_l > sum_r) sum_r += a[--j];
    if (sum_r == sum_l && i < j) res = max(res, sum_l);
  }
  cout << res << endl;
  return 0;
}
