#include <bits/stdc++.h>
using namespace std;
const int SIZE = 200007;
int n, m, d[SIZE];
vector<pair<int, int>> vec;
long long ans = 0, ls = 0, rs = 0;
int main(void) {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &d[i]);
  int i = 0, j = n - 1;
  while (i <= j) {
    if (ls == rs) {
      ans = max(ans, ls);
      ls += d[i++];
    } else if (ls < rs)
      ls += d[i++];
    else
      rs += d[j--];
  }
  if (ls == rs) ans = max(ans, ls);
  cout << ans << endl;
  return 0;
}
