#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long st1 = 0, st2 = n - 1, sum1 = 0, sum3 = 0, res = 0;
  while (st1 <= st2) {
    if (sum1 > sum3)
      sum3 += arr[st2--];
    else
      sum1 += arr[st1++];
    if (sum1 == sum3) res = max(res, sum1);
  }
  cout << res;
  return 0;
}
