#include using namespace std; int main(void){ int n; cin >> n; vector data(n); for(int i=0; i> data[i]; vector result(n, 0); result[0] = data[0]; result[1] = data[1]; if(n==1) { cout << data[0] << endl; } else if(n==2) { if(data[0]>data[1]) cout << data[0] << endl; else cout << data[1] << endl; } else { for(int i=2; itemp_max) temp_max = result[j]; } if(temp_max+data[i]>result[i-1]) { result[i] = temp_max+data[i]; } else { result[i] = result[i-1]; } } // for(int i=0; i