#include <bits/stdc++.h>
using namespace std;
const int _5 = 100005, _6 = 1000006;
long long n, a[_5 * 2], s1[_5 * 2], s2[_5 * 2], ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1, j = n; i <= n; i++, j--) {
    s1[i] = a[i] + s1[i - 1];
    s2[j] = a[j] + s2[j + 1];
  }
  for (int i = 1, j = n; i <= n, j > 0;) {
    if (i == j) break;
    if (s1[i] == s2[j] && ans < s1[i]) ans = s1[i];
    if (s1[i] < s2[j])
      i++;
    else
      j--;
  }
  cout << ans << endl;
  return 0;
}
