#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005];
map<int, int> mp;
int main() {
  int n, j, i = 1;
  long long sum1 = 0, sum2 = 0, ans = 0;
  scanf("%d", &n);
  for (int c = 1; c <= n; c++) scanf("%d", &a[c]);
  j = n;
  sum1 += a[i];
  sum2 += a[j];
  while (i < j) {
    if (sum1 > sum2) {
      j--;
      sum2 += a[j];
    } else if (sum1 == sum2) {
      ans = max(ans, sum1);
      i++;
      j--;
      sum1 += a[i];
      sum2 += a[j];
    } else if (sum1 < sum2) {
      i++;
      sum1 += a[i];
    }
  }
  printf("%lld\n", ans);
  return 0;
}
