grade = {"A": 4.0, "B": 3.0, "C": 2.0, "D": 1.0, "F": 0.0}
# list
list1 = []
list2 = []
while True:
    S = input()
    if S == "False":
        break
    else:
        score = int(input())
        weight = grade.get(S)
        list1.append(weight * score)
        list2.append(score)
print("{:.2f}".format(sum(list1) / sum(list2)))