gl = {"A":4.0, "B":3.0, "C":2.0, "D":1.0, "F":0}
al = []
bl = []
while True:
    g = input()
    if g == "False":
        break
    else:
        sco = int(input())
        al.append(gl[g]*sco)
        bl.append(sco)
print("%.2f" % (sum(al) / sum(bl)))