g = {'A':4,'B':3,'C':2,'D':1,'F':0}
a1 = []
a2 = []
n1 = input()
while n1 != "False":
    n2 = int(input())
    a1.append(n2)
    a2.append(g[n1] * n2)
    n1 = input()
ans = sum(a2) / sum(a1)
print("%.2f"%ans)