#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
long long n, a[N];
long long spre[N], send[N];
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    spre[i] = spre[i - 1] + a[i];
  }
  for (long long i = n; i >= 1; i--) {
    send[i] = send[i + 1] + a[i];
  }
  long long ans = 0;
  long long l = 1, r = n;
  while (l < r) {
    if (spre[l] == send[r]) ans = max(ans, spre[l]);
    if (spre[l] < send[r])
      l++;
    else
      r--;
  }
  cout << ans << endl;
  return 0;
}
