5314: 【GESP202312六级】闯关游戏

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:1 Solved:1

Description

Input

Output

Sample Input Copy

6 2
2 3
1 0 30 100 30 30

Sample Output Copy

131

HINT

样例解释1:

样例解释2: