#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7f7f7f7f;
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
long long sum1[200005];
long long sum2[200005];
long long arr[200005];
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sum1[0] = arr[0];
  for (int i = 1; i < n; i++) {
    sum1[i] = sum1[i - 1] + arr[i];
  }
  reverse(arr, arr + n);
  sum2[0] = arr[0];
  for (int i = 1; i < n; i++) {
    sum2[i] = sum2[i - 1] + arr[i];
  }
  int i = 0, j = 0;
  long long mx = 0;
  while (i < n && j < n) {
    if (sum1[i] == sum2[j] && n - j - 1 > i) {
      long long val = sum1[i];
      mx = max(mx, val);
      i++;
      j++;
    } else if (sum1[i] > sum2[j])
      j++;
    else
      i++;
  }
  cout << mx << endl;
  return 0;
}
