#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
vector<int> prime((long long)(1e7), 1);
void seive(long long n) {
  long long i, j;
  prime[0] = prime[1] = 0;
  for (i = 2; i * i <= n; i++) {
    if (prime[i] == 1) {
      for (j = i * i; j <= n; j += i) prime[j] = 0;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t, n, i, j, q, d;
  string str;
  char ch[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
               'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  i = 0;
  j = n - 1;
  long long ans = 0;
  long long sum1 = 0, sum2 = 0;
  while (i <= j) {
    if (sum1 == sum2) ans = sum1;
    if (sum1 <= sum2) {
      sum1 += a[i];
      i++;
    } else {
      sum2 += a[j];
      j--;
    }
    if (sum1 == sum2) ans = sum1;
  }
  cout << ans;
  return 0;
}
