otosidama=0.0
for i in range(int(input())):
  x, u = input().split()
  otosidama += float(x) if u=='JPY' else float(x)*380000.0
  
print(otosidama) otosidama=0.0 otosidama 0.0 for i in range(int(input())):
  x, u = input().split()
  otosidama += float(x) if u=='JPY' else float(x)*380000.0
   i range(int(input())) range int(input()) int input() input x, u = input().split() x input().split() ().split () input split u otosidama += float(x) if u=='JPY' else float(x)*380000.0 otosidama float(x) if u=='JPY' else float(x)*380000.0 u=='JPY' u 'JPY' float(x) float x float(x)*380000.0 float(x) float x 380000.0 print(otosidama) print otosidama otosidama += float(x) if u=='JPY' else float(x)*380000.0 float(x) if u=='JPY' else float(x)*380000.0 otosidama u = input().split() input().split() u x, u = input().split() input().split() x otosidama=0.0 0.0 otosidama
otosidama=0.0
for i in range(int(input())):
  x, u = input().split()
  otosidama += float(x) if u=='JPY' else float(x)*380000.0
  
print(otosidama)