dict_1 = {'A':4.0,'B':3.0,'C':2.0,'D':1.0,'F':0} score_1 = 0 score_2 = 0 while True: level = input() if level != 'False': num = int(input()) score_1 += num*dict_1[level] score_2 += num else: print(f'%.2f' %(score_1/score_2)) break