#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
long long n, a[maxn], ps1[maxn], ps2[maxn], ans, cnt;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  ps1[0] = a[0], ps2[0] = a[n - 1];
  for (int i = 1; i < n; i++) {
    ps1[i] = ps1[i - 1] + a[i];
    ps2[i] = ps2[i - 1] + a[n - i - 1];
  }
  for (int i = 0; i < n; i++) {
    int j = lower_bound(ps2, ps2 + n, ps1[i]) - ps2;
    if (i + 1 + j + 1 <= n && ps2[j] == ps1[i]) ans = ps1[i];
  }
  cout << ans << endl;
  return 0;
}
