import sys List = [] for i in sys.stdin: if "False" not in str(i): List.append(i) junji = 0 score = 0 for i in range(len(List)): if "A" in List[i]: junji += int(List[i+1]) * 4 score += int(List[i+1]) elif "B" in List[i]: junji += int(List[i+1]) * 3 score += int(List[i+1]) elif "C" in List[i]: junji += int(List[i+1]) * 2 score += int(List[i+1]) elif "D" in List[i]: junji += int(List[i+1]) * 1 score += int(List[i+1]) elif "F" in List[i]: junji += 0 score += int(List[i+1]) print("%.2f" % (junji / score))