A - Calculating Part-Time Job Pay Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 200

問題文

高橋君は今月、 N 種類のアルバイトをしました。

i 番目のアルバイトの時給は A_i 円で、高橋君はそのアルバイトを T_i 時間働きました。

高橋君が今月受け取る給料の合計金額(円)を求めてください。

制約

  • 1 \leq N \leq 10^5
  • 1 \leq A_i \leq 10^6
  • 1 \leq T_i \leq 10^6
  • 入力はすべて整数である

入力

N
A_1 T_1
A_2 T_2
\vdots
A_N T_N
  • 1 行目には、アルバイトの種類数を表す N が与えられる。
  • 続く N 行では、各アルバイトの情報が与えられる。
  • 1 + i 行目には、 i 番目のアルバイトの時給を表す A_i と、働いた時間を表す T_i が、スペース区切りで与えられる。

出力

高橋君が受け取る給料の合計金額(円)を 1 行で出力してください。


入力例 1

3
1000 5
1200 3
900 4

出力例 1

12200

入力例 2

2
850 1
1500 2

出力例 2

3850

入力例 3

7
980 12
1250 8
1500 6
1100 10
2000 3
950 15
1750 4

出力例 3

69010

入力例 4

15
1000 40
1200 35
950 28
1500 20
1300 22
1600 18
1100 30
1750 16
1400 25
2000 12
1050 27
1800 14
1550 19
900 33
1450 21

出力例 4

459150

入力例 5

1
1000000 1000000

出力例 5

1000000000000

Score : 200 pts

Problem Statement

Takahashi worked N different part-time jobs this month.

The hourly wage of the i-th job is A_i yen, and Takahashi worked T_i hours at that job.

Find the total salary (in yen) that Takahashi will receive this month.

Constraints

  • 1 \leq N \leq 10^5
  • 1 \leq A_i \leq 10^6
  • 1 \leq T_i \leq 10^6
  • All input values are integers

Input

N
A_1 T_1
A_2 T_2
\vdots
A_N T_N
  • The first line contains N, the number of types of part-time jobs.
  • The following N lines contain the information for each job.
  • The (1 + i)-th line contains A_i, the hourly wage of the i-th job, and T_i, the number of hours worked, separated by a space.

Output

Print the total salary (in yen) that Takahashi will receive, on a single line.


Sample Input 1

3
1000 5
1200 3
900 4

Sample Output 1

12200

Sample Input 2

2
850 1
1500 2

Sample Output 2

3850

Sample Input 3

7
980 12
1250 8
1500 6
1100 10
2000 3
950 15
1750 4

Sample Output 3

69010

Sample Input 4

15
1000 40
1200 35
950 28
1500 20
1300 22
1600 18
1100 30
1750 16
1400 25
2000 12
1050 27
1800 14
1550 19
900 33
1450 21

Sample Output 4

459150

Sample Input 5

1
1000000 1000000

Sample Output 5

1000000000000