Problem9140--ABC332 —— A - Online Shopping

9140: ABC332 —— A - Online Shopping

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

AtCoder Inc. sells merchandise through its [online shop](https://suzuri.jp/AtCoder/home).

Takahashi has decided to purchase $N$ types of products from there.  
For each integer $i$ from $1$ to $N$, the $i$\-th type of product has a price of $P_i$ yen each, and he will buy $Q_i$ of this.

Additionally, he must pay a shipping fee.  
The shipping fee is $0$ yen if the total price of the products purchased is $S$ yen or above, and $K$ yen otherwise.

He will pay the total price of the products purchased plus the shipping fee.  
Calculate the amount he will pay.

Input

The input is given from Standard Input in the following format:

```
$N$ $S$ $K$
$P_1$ $Q_1$
$P_2$ $Q_2$
$\vdots$
$P_N$ $Q_N$
```

Output

Print the amount Takahashi will pay for online shopping.

Constraints

-   $1\leq N\leq 100$
-   $1\leq S\leq 10000$
-   $1\leq K\leq 10000$
-   $1\leq P_i\leq 10000$
-   $1\leq Q_i\leq 100$
-   All input values are integers.

Sample 1 Input

2 2000 500
1000 1
100 6

Sample 1 Output

2100

Takahashi buys one product for 1000 yen and six products for 100 yen each.
Thus, the total price of the products is 1000×1+100×6=1600 yen.
Since the total amount for the products is less than 2000 yen, the shipping fee will be 500 yen.
Therefore, the amount Takahashi will pay is 1600+500=2100 yen.

Sample 2 Input

3 2000 500
1000 1
100 6
5000 1

Sample 2 Output

6600
The total price of the products is 1000×1+100×6+5000×1=6600 yen.
Since the total amount for the products is not less than 2000 yen, the shipping fee will be 0 yen.
Therefore, the amount Takahashi will pay is 6600+0=6600 yen.

Sample 3 Input

2 2000 500
1000 1
1000 1

Sample 3 Output

2000
There may be multiple products with the same price per item.

HINT

相同题目:ABC332

Source/Category