#include using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int N; cin >> N; int V[1006]; for (int i = 1; i <= N; i++) { cin >> V[i]; } int dp[1006][2] = {}; for (int i = 1; i <= N; i++) { dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]); dp[i][1] = dp[i - 1][0] + V[i]; } cout << *max_element(dp[N], dp[N] + 2) << endl; return 0; }