LearnPy Hub
← Arena
IntermediateRating 1100

Cheapest Climb

cost[i] is paid when you step on stair i. Start on stair 0 or 1, move 1 or 2 stairs, and reach the top (past the last stair). Print the minimum cost.

Input

n, then n costs.

Output

A number.

Sample 1

Input
3
10 15 20
Output
15

Sample 2

Input
10
1 100 1 1 1 100 1 1 100 1
Output
6
solution.py
Output appears here
Cheapest Climb · Python Arena problem · LearnPy Hub