#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, R1 = 0, F1 = 0, F3;
  long long S1, S3, RS1 = 0;
  cin >> n;
  F3 = n - 1;
  vector<long long> Num(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> Num[i];
  }
  S1 = Num[0];
  S3 = Num[n - 1];
  for (int i = 1; i < n; i++) {
    if (S1 == S3) {
      R1 = F1;
      RS1 = S1;
      F1++;
      S1 += Num[F1];
    } else if (S1 < S3) {
      F1++;
      S1 += Num[F1];
    } else {
      F3--;
      S3 += Num[F3];
    }
  }
  cout << RS1;
  return 0;
}
