#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  long long n;
  long long arr[200001];
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  long long count = n;
  long long front = -1;
  long long back = n;
  long long ans = 0;
  long long front_sum = 0;
  long long back_sum = 0;
  while (count >= 0) {
    if (front_sum == back_sum) {
      ans = front_sum;
      front += 1;
      front_sum += arr[front];
      back -= 1;
      back_sum += arr[back];
      count -= 2;
    } else if (front_sum > back_sum) {
      back -= 1;
      back_sum += arr[back];
      count -= 1;
    } else if (front_sum < back_sum) {
      front += 1;
      front_sum += arr[front];
      count -= 1;
    }
  }
  cout << ans;
  return 0;
}
