#include <bits/stdc++.h>
using namespace std;
inline char getc() {
  static char buf[1 << 14], *p1 = buf, *p2 = buf;
  return (p1 == p2) &&
                 (p2 = (p1 = buf) + fread(buf, 1, 1 << 14, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int scan() {
  register char ch = 0;
  register int x = 0, f = 1;
  while (ch < 48) ch == '-' && (f = -1), ch = getc();
  while (ch >= 48) x = x * 10 + ch - 48, ch = getc();
  return x * f;
}
inline void print(const long long& x) {
  if (x > 9) print(x / 10);
  putchar(x % 10 + 48);
}
const int N = 2e5 + 5;
int n, A[N], l, r;
long long res, lsum, rsum;
int main() {
  n = scan();
  l = 0, r = n + 1;
  for (register int i = 1; i <= n; i++) A[i] = scan();
  while (l < r) {
    if (lsum == rsum) res = lsum;
    if (lsum <= rsum)
      lsum += A[++l];
    else
      rsum += A[--r];
  }
  print(res);
  return 0;
}
