#Lutece0152. GPA计算

GPA计算

Migrated from Lutece 152 GPA计算

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

G.P.A.(Grade Point Average)即成绩点数与学分的加权平均值。 GPA一般用4分制(4.00 scale)计算,换算方法参见下表:

百分制分数 等级 成绩点数
90-100 A 4
80-89 B 3
70-79 C 2
60-69 D 1
60以下 E 0

例如某同学三门课程的学分和成绩为:

  • A课程4个学分,成绩92(A)
  • B课程3个学分,成绩75(C)
  • C课程5个学分,成绩80(B)

$GPA = \frac{4\times 4 + 2\times 3 + 3\times 5} {4 + 3 + 5} = 3.08$

Input

输入第一行为整数NN(1N101\leq N\leq 10),表示有NN门课程。

以下NN行每行为两个整数CC, SS (1C51\leq C\leq 5, 0S1000\leq S\leq 100)表示该门课程的学分和成绩。

Output

输出仅一个小数gg,表示该同学的GPA,结果保留22位小数

Samples

3
4 92
3 75
5 80
3.08

Resources

love8909