import std;

long calcEven(int[] a) {
    assert(a.length % 2 == 0);

    long sum1 = 0;
    long sum2 = 0;
    for (int i = 0; i < a.length; i += 2) {
        sum1 += a[i];
        sum2 += a[i+1];
    }
    return max(sum1, sum2);
}

long calc(int[] a) {
    if (a.length % 2 == 0) return calcEven(a);

    alias Key = Tuple!(int, int, int);

    long ans = long.min;
    void rec(int p, int skipped, int selected, long sum, ref long[Key] memo) {
        if (p >= a.length) {
            if (selected == a.length / 2) {
                // writeln("skip ", skipped, " select ", selected, " sum " , sum);
                ans = max(ans, sum);
            }
            return;
        }

        long m = memo.get(Key(p, skipped, selected), long.min);
//        if (m != long.min && sum >= m) return;
        memo[Key(p, skipped, selected)] = sum;

        rec(p + 2, skipped, selected + 1, sum + a[p], memo);
        if (skipped < 2) {
            rec(p + 1, skipped + 1, selected, sum, memo);
        }
    }

    long[Key] memo;
    rec(0, 0, 0, 0, memo);
    return ans;
}

void main() {
    readint;
    auto a = readints;
    writeln(calc(a));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
