Codeforces Round 280 (Div. 2)
C
Vanya and Exams
Codeforces
1400
原题
← BD →
翻译中…

Vanya wants to pass $*n*$ exams and get the academic scholarship. He will get the scholarship if the average grade mark for all the exams is at least $*avg*$. The exam grade cannot exceed $*r*$. Vanya has passed the exams and got grade $*a*_{*i*}$ for the $*i*$-th exam. To increase the grade for the $*i*$-th exam by 1 point, Vanya must write $*b*_{*i*}$ essays. He can raise the exam grade multiple times.

翻译中…

What is the minimum number of essays that Vanya needs to write to get scholarship?

翻译中…

Input

翻译中…

The first line contains three integers $*n*$, $*r*$, $*avg*$ ($1 ≤ *n* ≤ 10^{5}$, $1 ≤ *r* ≤ 10^{9}$, $1 ≤ *avg* ≤ *min*(*r*, 10^{6})$) — the number of exams, the maximum grade and the required grade point average, respectively.

翻译中…

Each of the following $*n*$ lines contains space-separated integers $*a*_{*i*}$ and $*b*_{*i*}$ ($1 ≤ *a*_{*i*} ≤ *r*$, $1 ≤ *b*_{*i*} ≤ 10^{6}$).

翻译中…

Output

翻译中…

In the first line print the minimum number of essays.

翻译中…

Note

翻译中…

In the first sample Vanya can write 2 essays for the 3rd exam to raise his grade by 2 points and 2 essays for the 4th exam to raise his grade by 1 point.

翻译中…

In the second sample, Vanya doesn't need to write any essays as his general point average already is above average.

翻译中…

样例

Input #1
5 5 4
5 2
4 7
3 1
3 2
2 5
Output #1
4
InputCopy OutputCopy
Input #2
2 5 4
5 2
5 2
Output #2
0
InputCopy OutputCopy
题目信息
题号
492C
时间限制
1 s
内存限制
256 MB
标签
贪心
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。