#include <bits/stdc++.h>
using namespace std;
long long team[210000];
long long pre1[210000] = {0}, pre2[210000] = {0};
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &team[i]);
  for (int i = 1; i <= n; i++) pre1[i] = pre1[i - 1] + team[i];
  for (int i = n; i >= 1; i--) pre2[i] = pre2[i + 1] + team[i];
  long long ans = 0;
  for (int i = n; i > 1; i--) {
    int index = lower_bound(pre1 + 1, pre1 + 1 + n, pre2[i]) - pre1;
    if (index < i && pre2[i] == pre1[index]) ans = max(ans, pre2[i]);
  }
  printf("%lld", ans);
  return 0;
}
