price=0
for _ in range(int(input())):
  a,b=input().split()
  if b=='JPY': price+=float(a)
  else: price+=float(a)*380000
print(price) price=0 price 0 for _ in range(int(input())):
  a,b=input().split()
  if b=='JPY': price+=float(a)
  else: price+=float(a)*380000 _ range(int(input())) range int(input()) int input() input a,b=input().split() a input().split() ().split () input split b if b=='JPY': price+=float(a)
  else: price+=float(a)*380000 b=='JPY' b 'JPY' print(price) print price price=0 0 price a,b=input().split() input().split() a b=input().split() input().split() b
price=0
for _ in range(int(input())):
  a,b=input().split()
  if b=='JPY': price+=float(a)
  else: price+=float(a)*380000
print(price)