#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
int main() {
  int n;
  scanf("%d", &n);
  vector<long long> a(n);
  vector<long long> L(n), R(n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
    L[i] = (i == 0 ? a[i] : L[i - 1] + a[i]);
  }
  for (int i = n - 1; i >= 0; --i) {
    R[i] = (i == n - 1 ? a[i] : R[i + 1] + a[i]);
  }
  reverse(R.begin(), R.end());
  long long best = 0;
  for (int i = 0; i < n; ++i) {
    auto it = lower_bound(R.begin(), R.end(), L[i]);
    if (it != R.end() && *it == L[i]) {
      if (i + 1 + (it - R.begin() + 1) <= n) best = L[i];
    }
  }
  printf("%lld\n", best);
  return 0;
}
