import sys

a={
    'A':4.0,
    'B':3.0,
    'C':2.0,
    'D':1.0,
    'F':0
}

c=[]
while True:
    b=input()
    c.append(b)
    if b == 'False':
        break
sum=0
d=0
for i in range(0,len(c)-1,2):
    sum = sum + (a.get(c[i]) * float(c[i+1]))
    d = d + int(c[i+1]) 

print("%.2f" %(sum/d))