#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int a[maxn];
int main() {
  int n;
  long long sum1 = 0, sum2 = 0, ans;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = -1, j = n; j != i;) {
    if (sum1 == sum2) {
      ans = sum1;
      i++;
      sum1 += a[i];
      continue;
    }
    if (sum1 > sum2) {
      j--;
      sum2 += a[j];
      continue;
    }
    if (sum1 < sum2) {
      i++;
      sum1 += a[i];
      continue;
    }
  }
  cout << ans << endl;
  return 0;
}
