#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long in[N], sum[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", in + i);
    sum[i] = sum[i - 1] + in[i];
  }
  long long total = sum[n];
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    long long s1 = sum[i];
    long long s2 = total - 2 * s1;
    if (2 * s1 > total) break;
    long long ss = s1 + s2;
    int p = lower_bound(sum + 1, sum + 1 + n, ss) - sum;
    if (p <= n and sum[p] == ss) {
      res = max(s1, res);
    }
  }
  printf("%lld\n", res);
}
