问题

### Instructions: You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.
### Question:
AtCoder Inc. sells merchandise through its online shop.
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 Input 1

2 2000 500
1000 1
100 6

Sample Output 1

2100

Takahashi buys one product for 1000 yen and six products for 100 yen each.
Thus, the total price of the products is 1000\times 1+100\times 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 Input 2

3 2000 500
1000 1
100 6
5000 1

Sample Output 2

6600

The total price of the products is 1000\times 1+100\times 6+5000\times 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 Input 3

2 2000 500
1000 1
1000 1

Sample Output 3

2000

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

### Format: Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within delimiters as follows.
```python
# YOUR CODE HERE
```

### Answer: (use the provided format with backticks)

答案

模型 模型答案 正确答案
金声玉亮2.0 ```python
# YOUR CODE HERE
import sys
input = sys.stdin.read
data = input().split()

N = int(data[0])
S = int(data[1])
K = int(data[2])

total_price = 0
index = 3
for _ in range(N):
P = int(data[index])
Q = int(data[index + 1])
total_price += P * Q
index += 2

if total_price < S:
total_price += K

print(total_price)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
deepseek-r1

```python
n, s, k = map(int, input().split())
total = 0
for _ in range(n):
p, q = map(int, input().split())
total += p * q
print(total + (0 if total >= s else k))
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
gpto1 ```python
# YOUR CODE HERE
n, s, k = map(int, input().split())
total = 0
for _ in range(n):
p_i, q_i = map(int, input().split())
total += p_i * q_i

if total >= s:
shipping_fee = 0
else:
shipping_fee = k

print(total + shipping_fee)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
gpt-4o-2024-08-06 ```python
# YOUR CODE HERE
def calculate_total_payment():
import sys
input = sys.stdin.read
data = input().split()

N = int(data[0])
S = int(data[1])
K = int(data[2])

total_price = 0
index = 3
for _ in range(N):
P = int(data[index])
Q = int(data[index + 1])
total_price += P * Q
index += 2

if total_price < S:
total_price += K

print(total_price)

calculate_total_payment()
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
DeepSeek-Coder-V2-Lite-Instruct ```python
# YOUR CODE HERE

# Read the inputs
N, S, K = map(int, input().split())

# Initialize the total price
total_price = 0

# Read the prices and quantities for each product
for _ in range(N):
P, Q = map(int, input().split())
total_price += P * Q

# Calculate the shipping fee
shipping_fee = K if total_price < S else 0

# Calculate the total amount to be paid
amount_to_pay = total_price + shipping_fee

# Print the result
print(amount_to_pay)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
Meta-Llama-3.1-405B-Instruct-Turbo ```python
import sys

# Read input from stdin
N, S, K = map(int, sys.stdin.readline().split())
products = []
for _ in range(N):
P, Q = map(int, sys.stdin.readline().split())
products.append((P, Q))

# Calculate total price of products
total_price = sum(P * Q for P, Q in products)

# Calculate shipping fee
shipping_fee = 0 if total_price >= S else K

# Calculate total amount to pay
total_amount = total_price + shipping_fee

# Write answer to stdout
print(total_amount)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
Meta-Llama-3.1-70B-Instruct-Turbo ```python
# YOUR CODE HERE
import sys

n, s, k = map(int, input().split())
total_price = 0

for _ in range(n):
p, q = map(int, input().split())
total_price += p * q

if total_price < s:
total_price += k

print(total_price)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
Qwen2-72B-Instruct ```python
n, s, k = map(int, input().split())
total_price = sum(int(p) * int(q) for _ in range(n) for p, q in [input().split()])
shipping_fee = 0 if total_price >= s else k
print(total_price + shipping_fee)
```
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
baichuan4 ```python
import sys

# Read input values
N, S, K = map(int, sys.stdin.readline().split())
total_price = 0

# Calculate the total price of the products
for _ in range(N):
P, Q = map(int, sys.stdin.readline().split())
total_price += P * Q

# Determine the shipping fee
shipping_fee = 0 if total_price >= S else K

# Calculate the total amount Takahashi will pay
total_amount = total_price + shipping_fee

# Print the result
print(total_amount)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
doubao ```python
N, S, K = map(int, input().split())
total_price = 0
for _ in range(N):
P, Q = map(int, input().split())
total_price += P * Q
if total_price >= S:
print(total_price)
else:
print(total_price + K)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
gpto1 ```python
# YOUR CODE HERE
n, s, k = map(int, input().split())
total = 0
for _ in range(n):
p_i, q_i = map(int, input().split())
total += p_i * q_i

if total >= s:
shipping_fee = 0
else:
shipping_fee = k

print(total + shipping_fee)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
kimi ```python
# YOUR CODE HERE
(n, s, k) = map(int, input().split())
total = 0
for _ in range(n):
(p, q) = map(int, input().split())
total += p * q
print(total + (k if total < s else 0))
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
minimax ```python
# YOUR CODE HERE
N, S, K = map(int, input().split())
total_price = 0

for _ in range(N):
P, Q = map(int, input().split())
total_price += P * Q

shipping_fee = K if total_price < S else 0
print(total_price + shipping_fee)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
wenxinyiyan ```python
# Read input values
N, S, K = map(int, input().split())
total_price = 0

# Calculate total price of products
for _ in range(N):
P, Q = map(int, input().split())
total_price += P * Q

# Calculate shipping fee and total amount to pay
shipping_fee = 0 if total_price >= S else K
amount_to_pay = total_price + shipping_fee

# Output the amount to pay
print(amount_to_pay)
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
zhipu ```python
import sys
input = sys.stdin.read

def main():
data = input().split()
N = int(data[0])
S = int(data[1])
K = int(data[2])

total_price = 0
index = 3
for _ in range(N):
P = int(data[index])
Q = int(data[index + 1])
total_price += P * Q
index += 2

if total_price < S:
total_price += K

print(total_price)

if __name__ == "__main__":
main()
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]
deepseek-v3 ```python
# YOUR CODE HERE
def main():
import sys
input = sys.stdin.read
data = input().split()

N = int(data[0])
S = int(data[1])
K = int(data[2])

index = 3
total_price = 0

for _ in range(N):
P = int(data[index])
Q = int(data[index + 1])
total_price += P * Q
index += 2

if total_price >= S:
shipping_fee = 0
else:
shipping_fee = K

total_amount = total_price + shipping_fee
print(total_amount)

if __name__ == "__main__":
main()
```
[{"input": "2 2000 500\n1000 1\n100 6\n", "output": "2100\n", "testtype": "stdin"}, {"input": "3 2000 500\n1000 1\n100 6\n5000 1\n", "output": "6600\n", "testtype": "stdin"}, {"input": "2 2000 500\n1000 1\n1000 1\n", "output": "2000\n", "testtype": "stdin"}]