#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a.at(i);
    }

    ll sum = 0;
    int mi = min_element(a.begin(), a.end()) - a.begin();
    if (n % 2 == 0) {
        if (mi % 2 == 0) {
            rep(i, n)
            {
                if (i % 2 == 1) {
                    sum += a.at(i);
                }
            }
        } else {
            rep(i, n)
            {
                if (i % 2 == 0) {
                    sum += a.at(i);
                }
            }
        }
    } else {
        ll sum_a = 0;
        ll sum_b = 0;
        rep(i, n)
        {
            if (i == mi)
                continue;
            else if (i % 2 == 0)
                sum_a += a.at(i);
            else {
                sum_b += a.at(i);
            }
        }
        sum = max(sum_a, sum_b);
    }

    cout << sum << endl;
}