score = {'A':4,'B':3,'C':2,'D':1,'F':0}
grades = []
credits = []
while True:
    grade = input().strip()  # 读取一行并去除首尾空白
    if grade == "False":     
        break  # 直到False才停止
    credit = float(input().strip())
    grades.append(grade)
    credits.append(credit)
total_score = 0
total_credict = 0

for g, c in zip(grades, credits):
    if g in score:
        total_score += score.get(g)*c
        total_credict += c

res = total_score/total_credict
print(f"{res:.2f}")