N = int(input())
foods = list(map(int, input().split()))
dp = [0] * 100
dp[0] = foods[0]
dp[1] = max(foods[0], foods[1])
for i in range(2, len(foods)):
    dp[i] = max(dp[i - 1], dp[i - 2] + foods[i])
print(dp[N - 1])

0d1acbdd1997924f045ad7e747600ce6a1903160
<mask token>

<mask token>
for i in range(2, len(foods)):
    dp[i] = max(dp[i - 1], dp[i - 2] + foods[i])
print(dp[N - 1])

N = int(input())
foods = list(map(int, input().split()))
dp = [0] * 100
dp[0] = foods[0]
dp[1] = max(foods[0], foods[1])
for i in range(2, len(foods)):
    dp[i] = max(dp[i - 1], dp[i - 2] + foods[i])
print(dp[N - 1])
