#include using namespace std; int N; int C[1000]; int memo[1000]; int dfs(int i) { if (i >= N) return 0; if (memo[i] >= 0) return memo[i]; return memo[i] = C[i] + max(dfs(i+2), dfs(i+3)); } int main() { memset(memo, -1, sizeof(memo)); cin >> N; for (int i = 0; i < N; ++i) cin >> C[i]; cout << max(dfs(0), dfs(1)) << endl; }