#include <bits/stdc++.h>
using namespace std;
class bit {
  vector<int> v;

 public:
  bit() { v.assign(1000000, 0); }

 public:
  int rsq(int idx) {
    int temp = 0;
    for (; idx; idx -= (idx & -(idx))) {
      temp += v[idx];
    }
    return temp;
  }

 public:
  int rsq(int a, int b) { return rsq(b) - rsq(a - 1); }

 public:
  void update(int idx) {
    for (; idx < v.size(); idx += (idx & -(idx))) {
      v[idx] += 1;
    }
  }
};
class trie {
  class node {
   public:
    int a[10];

   public:
    bool endHere;

   public:
    node() {
      for (int i = 0; i < 10; ++i) a[i] = 0;
      endHere = false;
    };
  };
  vector<node> v;

 public:
  trie() { v.push_back(node()); }

 public:
  void insert(string s) {
    int idx = 0;
    for (int i = 0; i < (int)s.size(); ++i) {
      int val = s[i] - '0';
      if (!v[idx].a[val]) {
        v.push_back(node());
        v[idx].a[val] = v.size() - 1;
      }
      idx = v[idx].a[val];
    }
  }
};
vector<int> v, back;
vector<vector<int> > adjlist;
long long n, m, u_, v_, c_, testcase, ans, k, minx = 1 << 30, maxn = -(1 << 30),
                                              sum, cnt, query, type, offset;
int a, b, temp, pos, lim, curr;
string s, t, p;
bool flag, bl, flipflop;
char c;
set<int> uni;
map<int, int> dict;
bitset<10000000> vis;
long long ago;
long long dp[100000], suml, sumr;
int main() {
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  int l = -1, r = n;
  while (l != r) {
    while (suml <= sumr) {
      if (suml == sumr) maxn = suml;
      ++l;
      if (l == n || l == r) {
        cout << maxn;
        exit(0);
      }
      suml += v[l];
    }
    while (sumr <= suml) {
      if (suml == sumr) maxn = suml;
      --r;
      if (r == -1 || l == r) {
        cout << maxn;
        exit(0);
      }
      sumr += v[r];
    }
  }
  cout << maxn;
}
