4701: P8767 [蓝桥杯 2021 国 A] 冰山
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description

Input

Output

Sample Input Copy
1 3 6
1
6 1
2 2
-1 1
Sample Output Copy
8
16
11
HINT
