#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n;
int a, b, c;
int v[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  long long sum = 0;
  long long auxA = 0, auxC = 0;
  c = n + 1;
  while (a < c) {
    if (auxA == auxC) {
      sum = auxA;
      if (a != c - 1) {
        a++;
        auxA += v[a];
      } else
        break;
    } else if (a == c - 1)
      break;
    else if (auxA < auxC) {
      a++;
      auxA += v[a];
    } else if (auxA > auxC) {
      c--;
      auxC += v[c];
    }
  }
  cout << sum;
  return 0;
}
