#include <bits/stdc++.h>
using namespace std;
template <class T>
void print(T& a) {
  for (auto x : a) cout << x << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, i;
  cin >> n;
  long long a[n + 5];
  for (i = 0; i < n; i++) cin >> a[i];
  long long cnt = a[0];
  long long j = n - 1;
  i = 0;
  long long sum = 0;
  long long c = a[n - 1];
  while (i < j) {
    if (cnt == c) sum = cnt;
    if (cnt <= c) {
      i++;
      cnt += a[i];
    } else {
      j--;
      c += a[j];
    }
  }
  cout << sum;
  return 0;
}
