#P14613. [2019 KAIST RUN Fall] And the Winner Is... Ourselves!

[2019 KAIST RUN Fall] And the Winner Is... Ourselves!

题目描述

Let us remind you about how the total penalties are calculated for this contest:

  • When you solve a problem at TT minutes, T+20VT+20V is added to your penalty, where VV is the number of incorrect verdicts (except compile errors) received on that problem.
  • If you do not solve a problem before the contest ends, the incorrect verdicts on that problem are not counted as penalties.

Here is a bad news for all of you: we, the problem setters, are planning to join the competition and solve our own problems!

We know our problems really well, so we can solve all the problems before the contest ends. Furthermore, we can precisely predict how long it takes to solve each problem, and how many incorrect verdicts (except compile errors) we get in each problem. Depending on the order of the problems we solve, our total penalty might differ. What is the minimum penalty if we solve all problems?

输入格式

11 lines are given as the input. The ii-th line contains two integers, DiD_i and ViV_i, where DiD_i is the amount of minutes required to solve the ii-th problem, and ViV_i is the number of incorrect verdicts on the ii-th problem.

For each ii, 1Di1 \leq D_i and 0Vi10000 \leq V_i \leq 1000. Also, i=111Di300\sum_{i=1}^{11} D_i \leq 300.

输出格式

Output the minimum penalty if we solve all problems.

20 1
20 0
20 3
10 0
10 0
10 0
30 0
30 0
30 0
20 0
20 10
1360

提示

The sample input does not necessarily reflect the actual difficulties of the problems.

The problem statement does not necessarily reflect the actual situation of the contest.