A - 予算オーバー 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 200

問題文

高橋君は N 個のプロジェクトを担当するマネージャーです。各プロジェクトにはすでに予算が割り当てられていますが、期末の見直しで、いくつかのプロジェクトに予算を割り当てすぎていたことが判明しました。

i 番目のプロジェクト (1 \leq i \leq N) には A_i 万円の予算が割り当てられており、適正な予算額は B_i 万円です。A_i > B_i であるとき、そのプロジェクトは 予算オーバー であり、A_i - B_i 万円を返還する必要があります。A_i \leq B_i であるとき、そのプロジェクトは予算オーバーではなく、返還の必要はありません。

予算オーバーとなっているプロジェクトの数と、返還が必要な金額の合計(万円)をそれぞれ求めてください。

制約

  • 1 \leq N \leq 2 \times 10^5
  • 1 \leq A_i \leq 10^9
  • 1 \leq B_i \leq 10^9
  • 入力はすべて整数である。

入力

入力は以下の形式で標準入力から与えられる。

N
A_1 B_1
A_2 B_2
\vdots
A_N B_N

1 行目にはプロジェクトの数 N が与えられる。続く N 行の i 行目 (1 \leq i \leq N) には、i 番目のプロジェクトに割り当てられた予算 A_i と適正な予算額 B_i が、スペース区切りで与えられる。

出力

予算オーバーとなっているプロジェクトの数と、返還が必要な金額の合計(万円)を、この順にスペース区切りで 1 行に整数で出力せよ。


入力例 1

3
100 80
50 50
30 60

出力例 1

1 20

入力例 2

5
500 300
200 400
150 100
600 600
800 350

出力例 2

3 700

入力例 3

10
1000000000 999999999
500000000 500000000
300000000 100000000
750000000 800000000
999999999 1
100 200
450000000 300000000
600000000 600000001
1 1000000000
888888888 777777777

出力例 3

5 1461111110

Score : 200 pts

Problem Statement

Takahashi is a manager in charge of N projects. Each project has already been allocated a budget, but during the end-of-term review, it was discovered that some projects had been allocated too much budget.

The i-th project (1 \leq i \leq N) has been allocated a budget of A_i ten-thousand yen, and the appropriate budget amount is B_i ten-thousand yen. When A_i > B_i, that project is over budget, and A_i - B_i ten-thousand yen must be returned. When A_i \leq B_i, that project is not over budget, and no return is necessary.

Find the number of projects that are over budget and the total amount of money (in ten-thousand yen) that needs to be returned.

Constraints

  • 1 \leq N \leq 2 \times 10^5
  • 1 \leq A_i \leq 10^9
  • 1 \leq B_i \leq 10^9
  • All inputs are integers.

Input

The input is given from standard input in the following format:

N
A_1 B_1
A_2 B_2
\vdots
A_N B_N

The first line gives the number of projects N. The i-th line (1 \leq i \leq N) of the following N lines gives the allocated budget A_i and the appropriate budget amount B_i for the i-th project, separated by a space.

Output

Output the number of projects that are over budget and the total amount of money (in ten-thousand yen) that needs to be returned, in this order, separated by a space, on a single line as integers.


Sample Input 1

3
100 80
50 50
30 60

Sample Output 1

1 20

Sample Input 2

5
500 300
200 400
150 100
600 600
800 350

Sample Output 2

3 700

Sample Input 3

10
1000000000 999999999
500000000 500000000
300000000 100000000
750000000 800000000
999999999 1
100 200
450000000 300000000
600000000 600000001
1 1000000000
888888888 777777777

Sample Output 3

5 1461111110