#CCBOTPBA0000039. Chọn loại phí và cộng dồn (Fee Types and Total Cost)
Chọn loại phí và cộng dồn (Fee Types and Total Cost)
Fee Types and Total Cost
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
There are n fees, each with type m in {1,2,3} and nonnegative base x. Each fee costs m*x. Print the 64-bit total, or zero when empty.
Input
First n, followed by n pairs m x.
Output
Print the integer total with no currency symbol.
Subtasks
-
Subtask 1 (20%):
n ≤ 20,x ≤ 100. -
Subtask 2 (30%):
n ≤ 1000,x ≤ 10^6. -
Subtask 3 (50%):
n ≤ 100000,x ≤ 10^9.
Examples
Example 1
Input:
3
1 10
2 7
3 4
Output:
36
Explanation: The total is 10+14+12=36.
Example 2
Input:
0
Output:
0
Explanation: The empty set of fees costs zero.