#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a[200009], i, j, s = 0, sum = 0, k = 0, f = 0, max;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  if (n % 2) k = 1;
  if (n == 1) {
    cout << "0";
    return 0;
  }
  i = 1;
  j = n;
  sum += a[i];
  s += a[j];
  while (i < j) {
    if (sum < s) {
      i++;
      if (i < j) sum += a[i];
    } else if (sum > s) {
      j--;
      if (i < j) s += a[j];
    } else if (sum == s) {
      f = 1;
      max = sum;
      i++;
      if (i < j) sum += a[i];
    }
  }
  if (sum == s) {
    f = 1;
    max = sum;
  }
  if (f == 1)
    cout << max;
  else
    cout << "0";
  return 0;
}
