#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  long long left_sum = 0;
  long long right_sum = 0;
  int mid_index = 0;
  for (int i = 0; i < n; i++) {
    left_sum += arr[i];
    right_sum = sum - left_sum;
    if (left_sum == right_sum) {
      cout << left_sum << endl;
      return 0;
    }
    if (left_sum > right_sum) {
      mid_index = i;
      break;
    }
  }
  int i = mid_index;
  int j = mid_index + 1;
  while (i >= 0 && j < n) {
    if (left_sum > right_sum) {
      left_sum -= arr[i];
      i--;
    }
    if (right_sum > left_sum) {
      right_sum -= arr[j];
      j++;
    }
    if (left_sum == right_sum) {
      cout << left_sum << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}
