#include <bits/stdc++.h>
using namespace std;
long long sum1, sum2, ans, a[200200];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, counter1 = 0, counter2 = 1;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sum1 += a[counter1];
  counter1++;
  for (int i = 0; i < n; i++) {
    if (counter1 - 1 > n - counter2) break;
    if (sum1 == sum2) ans = sum1;
    if (sum1 <= sum2) {
      sum1 += a[counter1];
      counter1++;
    } else {
      sum2 += a[n - counter2];
      counter2++;
    }
  }
  cout << ans;
  return 0;
}
