score_dict = {"A":4.0, "B":3.0, "C":2.0, "D":1.0, "F":0}
score = 0
score_lst = []
mark_lst = []
while True:
    level = input()
    if level == 'False':
        break
    elif level:
        mark = int(input())
        score_lst.append(score_dict[level] * mark)
        mark_lst.append(mark)
print("%.2f" % (sum(score_lst)/sum(mark_lst)))