#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const long double eps = 1e-9;
long long mod = 998244353;
const long long N = 1e6 + 5;
long long n;
long long a[N], b[N];
long long ans = 0;
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++)
    scanf("%lld", &a[i]), b[i] = b[i - 1] + a[i];
  long long s = b[n];
  for (long long i = 1; i <= n; i++) {
    if (b[i] * 2 <= s) {
      long long p = upper_bound(b + i + 1, b + 1 + n, s - b[i]) - b;
      if (b[i] == s - b[p - 1]) ans = b[i];
    } else
      break;
  }
  cout << ans;
}
