#include <bits/stdc++.h>
const long double PI = acos(-1);
using namespace std;
ifstream fin("sublime.in");
ofstream fout("sublime.out");
int main() {
  int n, v[200002];
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
  }
  int i = 1, j = n;
  long long sumi = 0, sumj = 0;
  long long sol = 0;
  bool solutie = false;
  while (i < j) {
    sumi += v[i];
    while (sumj + v[j] <= sumi && j > i) {
      sumj += v[j];
      --j;
    }
    if (sumi == sumj) {
      solutie = true;
      sol = sumi;
    }
    ++i;
  }
  if (solutie)
    cout << sol;
  else
    cout << 0;
  return 0;
}
