#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  int n; cin>>n;
  const ll INF = 1e18;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  vector<vll> dp(n+1, vll(5, -INF));
  dp[0][0] = 0;
  int k = n%2+1;
  rep(i,n) repc(j,k) {
    chmax(dp[i+1][j+1], dp[i][j]);
    if((i+j)%2==0) chmax(dp[i+1][j], dp[i][j] + A[i]);
    else chmax(dp[i+1][j], dp[i][j]);
  }
  cout << dp[n][k] << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
bool prime[MAX];
int prime_numbers[9999999],pos;
void sieve()
{
    prime[0]=1;
    prime[1]=1;
    for(int i=4; i<=MAX; i+=2)
        prime[i]=1;
    int root = sqrt(MAX);
    for(int i=3; i<=root; i+=2)
    {
        if(prime[i]==0)
        {
            for(int j=i*i; j<=MAX; j+=i)
            {
                prime[j]=1;
            }
        }
    }
    prime_numbers[pos++]=2;
    for(int i=3; i<MAX; i+=2)
        if(prime[i]==0)
            prime_numbers[pos++]=i;
}
map<int,int>mp;
void recur(int pos,int sum,int taken,vector<int>v)
{
    if(pos>=20)
        return;
    if(taken==5)
    {
        if(sum==67)
        {
           for(int i=0;i<5;i++)
            cout<<v[i]<<" ";
           cout<<endl;
        }

        mp[sum]++;
        return ;
    }
    v.push_back(prime_numbers[pos]);
    recur(pos+1,sum+prime_numbers[pos],taken+1,v);
    v.pop_back();
    recur(pos+1,sum,taken,v);
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    sieve();
 //   for(int i=0; prime_numbers[i]<55555; i++)
    //    cout<<prime_numbers[i]<<" "<<mp[prime_numbers[i]]<<endl;
    int n;
    cin>>n;
    for(int i=0;i<pos;i++){
        if(prime_numbers[i]%10==7){
            cout<<prime_numbers[i]<<" ";
         n--;
        }
        if(n==0)
            break;
    }




    return 0;
}
