#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    while(cin >>n)
    {
        vector<int> nums(n);
        for(int i = 0; i < n; i++)
        {
            cin >> nums[i];
        }
        int i = 0, j = n-1;
        long long left = 0, right = 0;
        long long res = 0;
        if(n <= 1)
        {
            cout << 0 << endl;
            continue;
        }
        while(i <= j)
        {
            if(left <= right)
            {
                if(left == right)
                    res = left;
                left += nums[i];
                i++;
            }
            else
            {
                right += nums[j];
                j--;
            }
        }
        if(left == right)
            res = left;
        cout << res << endl;
        
    }
}