#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long int sum_a = 0, ans = 0;
  long long int sum_x = 0;
  int j = n - 1;
  for (int i = 0; i < n; i++) {
    bool a = 0;
    sum_a += arr[i];
    for (; j > i;) {
      sum_x += arr[j];
      j -= 1;
      if (sum_x > sum_a) {
        a = 1;
        j = j + 1;
        sum_x -= arr[j];
        break;
      } else if (sum_x == sum_a) {
        ans = sum_a;
        a = 1;
        break;
      }
    }
    if (a == 0) {
      cout << ans << endl;
      return 0;
    }
  }
  cout << ans << endl;
}
