#include using namespace std; #define REP(i,a,b) for(i=a;i'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);} void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);} int N, V[1111], dp[1111]; int main(){ int i, j, k; reader(&N); rep(i,N) reader(V+i); dp[0] = V[0]; dp[1] = V[1]; REP(i,2,N) dp[i] = max(dp[i-1], dp[i-2]+V[i]); writer(dp[N-1],'\n'); return 0; }