import numpy as np

people_num = int(eval(input()))



otoshidama_box = []



for i in range(people_num):

    value, v_type = [_ for _ in input().split()]

    value = float(value)

    if str(v_type) == "JPY":

        ans = value

    elif str(v_type) == "BTC":

        ans = value * 380000.0

    

    otoshidama_box.append(float(ans))

otoshidama_box = np.array(otoshidama_box)

total = np.sum(otoshidama_box)

print(total)
n = int(eval(input()))



ans = 0

for _ in range(n):

    value, v_type = input().split()

    value = float(value)

    if v_type=="BTC":

        ans += value * 380000.0

    else:

        ans += value

print(ans)
import numpy as np

people_num = int(eval(input()))
otoshidama_box = []
for i in range(people_num):
    value, v_type = [_ for _ in input().split()]
    value = float(value)
    if str(v_type) == "JPY":
        ans = value
    elif str(v_type) == "BTC":
        ans = value * 380000.0
    otoshidama_box.append(float(ans))
otoshidama_box = np.array(otoshidama_box)
total = np.sum(otoshidama_box)
print(total)

n = int(eval(input()))
ans = 0
for _ in range(n):
    value, v_type = input().split()
    value = float(value)
    if v_type == "BTC":
        ans += value * 380000.0
    else:
        ans += value
print(ans)

-import numpy as np - -people_num = int(eval(input())) -otoshidama_box = [] -for i in range(people_num): -    value, v_type = [_ for _ in input().split()] +n = int(eval(input())) +ans = 0 +for _ in range(n): +    value, v_type = input().split() -    if str(v_type) == "JPY": -        ans = value -    elif str(v_type) == "BTC": -        ans = value * 380000.0 -    otoshidama_box.append(float(ans)) -otoshidama_box = np.array(otoshidama_box) -total = np.sum(otoshidama_box) -print(total) +    if v_type == "BTC": +        ans += value * 380000.0 +    else: +        ans += value +print(ans)