n = int(input())
jpy = 0
btc = 0
for i in range(n):
    x,u = input().split()
    if u == 'JPY':
        jpy += float(x)
    if u == 'BTC':
        btc += float(x)
print(jpy+(btc)*380000) n = int(input()) n int(input()) int input() input jpy = 0 jpy 0 btc = 0 btc 0 for i in range(n):
    x,u = input().split()
    if u == 'JPY':
        jpy += float(x)
    if u == 'BTC':
        btc += float(x) i range(n) range n x,u = input().split() x input().split() ().split () input split u if u == 'JPY':
        jpy += float(x)
     u == 'JPY' u 'JPY' jpy += float(x) jpy float(x) float x if u == 'BTC':
        btc += float(x) u == 'BTC' u 'BTC' btc += float(x) btc float(x) float x print(jpy+(btc)*380000) print jpy+(btc)*380000 jpy (btc)*380000 btc 380000 jpy += float(x) float(x) jpy u = input().split() input().split() u jpy = 0 0 jpy btc = 0 0 btc n = int(input()) int(input()) n x,u = input().split() input().split() x btc += float(x) float(x) btc
n = int(input())
jpy = 0
btc = 0
for i in range(n):
    x,u = input().split()
    if u == 'JPY':
        jpy += float(x)
    if u == 'BTC':
        btc += float(x)
print(jpy+(btc)*380000)