#include <bits/stdc++.h>
using namespace std;
long long i, i0, n, m, a[200005];
int main() {
  while (scanf("%lld", &n) != EOF) {
    for (i = 0; i < n; i++) scanf("%lld", &a[i]);
    long long ans = 0, sum1 = 0, sum2 = 0, p1 = 0, p2 = n - 1;
    while (1) {
      if (sum1 == sum2) {
        ans = sum1;
      }
      if (sum1 <= sum2) {
        sum1 += a[p1++];
      } else {
        sum2 += a[p2--];
      }
      if (sum1 == sum2) {
        ans = sum1;
      }
      if (p1 == p2 || p1 > p2) break;
    }
    if (p1 == p2) {
      if (sum1 + a[p1] == sum2)
        ans = sum1 + a[p1];
      else if (sum1 == a[p1] + sum2)
        ans = sum2 + a[p1];
    }
    printf("%lld\n", ans);
  }
  return 0;
}
