#include #include #include using namespace std; int main(){ int n; cin >> n; int before_2 = 0; int before_1 = 0; int ans = 0; for(int i=0; i> v; if(v+before_2 > before_1){ ans = v+before_2; } else{ ans = before_1; } before_2 = before_1; before_1 = ans; } cout << ans << endl; return 0; }