AtCoder Beginner Contest 119 - Digital Gifts

Takahashi received otoshidama (New Year's money gifts) from N of his relatives.
You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.
For example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.
If we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?

-----Constraints-----
 - 2 \leq N \leq 10
 - u_i = JPY or BTC.
 - If u_i = JPY, x_i is an integer such that 1 \leq x_i \leq 10^8.
 - If u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \leq x_i \leq 100.00000000.

-----Input-----
Input is given from Standard Input in the following format:
N
x_1 u_1
x_2 u_2
:
x_N u_N

-----Output-----
If the gifts are worth Y yen in total, print the value Y (not necessarily an integer).
Output will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.

-----Sample Input-----
2
10000 JPY
0.10000000 BTC

-----Sample Output-----
48000.0

The otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.
Outputs such as 48000 and 48000.1 will also be judged correct.

Source: atcoder | Difficulty: EASY


Solutions:
n = int(input())
btc = 380000.0
a = 0
for _ in range(n):
	(x, u) = input().split()
	if u == 'JPY':
		a += int(x)
	elif u == 'BTC':
		a += float(x) * btc
print(a)


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


n = int(input())
jpy = btc = 0
for i in range(n):
	(x, u) = map(str, input().split())
	if u == 'JPY':
		jpy += int(x)
	else:
		btc += float(x)
ans = jpy + 380000.0 * btc
print(ans)


t = 0
for i in range(int(input())):
	(s, a) = input().split()
	t += int(s) if a == 'JPY' else float(s) * 380000.0
print(t)


N = int(input())
list = []
for i in range(N):
	(a, b) = input().split()
	list.append((float(a), b))
sum = 0
for i in range(N):
	if list[i][1] == 'JPY':
		sum += list[i][0]
	else:
		sum += list[i][0] * 380000
print(sum)


n = int(input())
list = []
for i in range(n):
	(a, b) = input().split()
	list.append([float(a), b])
ans = 0
for i in range(n):
	if list[i][1] == 'JPY':
		ans += list[i][0]
	else:
		ans += 380000 * list[i][0]
print(ans)


N = int(input())
r = 380000
res = 0
for i in range(N):
	(x, u) = input().split()
	if u == 'JPY':
		res += int(x)
	else:
		res += float(x) * r
print(res)


n = int(input())
ans = float(0)
for _ in range(n):
	(m, u) = input().split()
	m = float(m)
	if u == 'JPY':
		ans += m
	else:
		ans += m * float(380000)
print(ans)


num = int(input())
total = 0
for i in range(num):
	(money, code) = input().split()
	if code == 'JPY':
		total += float(money)
	elif code == 'BTC':
		total += float(money) * 380000.0
print(total)


n = int(input())
c = 380000.0
sum = 0
for i in range(n):
	(x, y) = input().split()
	x = float(x)
	if y == 'BTC':
		x *= c
	sum += x
print(sum)


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


ans = 0.0
n = int(input())
for i in range(n):
	(a, s) = input().split()
	a = float(a)
	if s == 'BTC':
		a *= 380000.0
	ans += a
print(ans)


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


n = int(input())
(J, B) = (0, 0)
for i in range(n):
	(x, u) = map(str, input().split())
	if u == 'JPY':
		J += int(x)
	else:
		B += float(x)
ans = J + B * 380000
print(ans)


N = int(input())
m = []
for i in range(N):
	(x, u) = input().split(' ')
	if u == 'JPY':
		m.append(int(x))
	elif u == 'BTC':
		m.append(float(x) * 380000)
print(sum(m))


N = int(input())
U = {'JPY': 1.0, 'BTC': 380000.0}
ans = 0.0
for i in range(N):
	(x, u) = input().split()
	ans += float(x) * U[u]
print(ans)


N = int(input())
result = 0
for _ in range(N):
	(x, u) = input().split()
	x = float(x)
	if u == 'JPY':
		result += x
	else:
		result += x * (3.8 * 10 ** 5)
print(result)


a = 0
for i in range(int(input())):
	(v, u) = input().split()
	if u == 'JPY':
		a += int(v)
	else:
		a += float(v) * 380000
print(a)


N = int(input())
x = 0
for i in range(N):
	(a, b) = map(str, input().split())
	a = float(a)
	if b == 'BTC':
		a *= 380000.0
	x += a
print(x)


ans = 0
for i in range(int(input())):
	(a, b) = input().split()
	ans += float(a) * (1 if b[0] == 'J' else 380000)
print('%.6f' % ans)


n = int(input())
li = [list(input().split()) for i in range(n)]
total = 0
for i in range(n):
	if li[i][1] == 'JPY':
		total += float(li[i][0])
	else:
		total += float(li[i][0]) * 380000.0
print(total)


n = int(input())
c = 0
for i in range(n):
	l = input().split()
	x = float(l[0])
	u = l[1]
	if u == 'BTC':
		c += x * 380000.0
	else:
		c += x
print(c)


n = int(input())
y = 0
for i in range(n):
	(x, u) = input().split()
	if u == 'JPY':
		y += int(x)
	if u == 'BTC':
		y += 100000 * float(x) / 100000 * 380000.0
print(y)


import sys
lines = [s.rstrip('\n') for s in sys.stdin.readlines()]
(n,) = [int(num) for num in lines.pop(0).split(' ')]

def iter_value_and_unit():
	for line in lines:
		(value, unit) = line.split(' ')
		value = float(value)
		if unit == 'BTC':
			yield (380000.0 * value)
		else:
			yield value
print(sum(iter_value_and_unit()))


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


N = int(input())
ans = 0
for i in range(N):
	(x, u) = input().split()
	x = float(x)
	if u == 'BTC':
		ans += 380000.0 * x
	elif u == 'JPY':
		ans += x
print(ans)


ans = 0
for i in range(int(input())):
	(b, c) = input().split()
	ans += float(b) * (1 if c == 'JPY' else 380000)
print(ans)


N = int(input())
XU = [input().split() for i in range(N)]
print(sum([float(x) * {'JPY': 1, 'BTC': 380000}[u] for (x, u) in XU]))


print(sum((380000.0 ** ('B' in s) * float('0' + s[:-4]) for s in open(0))))


N = int(input())
ans = 0
for i in range(N):
	(x, y) = input().split()
	x = float(x)
	ans += x * 380000 if y == 'BTC' else x
print(ans)


print(sum([eval(input().replace(' ', '*').replace('JPY', '1').replace('BTC', '380000.0')) for i in range(int(input()))]))


print(sum((eval(input().replace(' JPY', '').replace(' BTC', '*380000')) for _ in range(int(input())))))


n = int(input())
cnt = 0
for _ in range(n):
	(x, u) = map(str, input().split())
	if u == 'JPY':
		cnt += float(x)
	else:
		cnt += float(x) * 380000.0
print(cnt)


(n, *a) = open(0).read().split()
print(sum(([float(a[s]) * 380000.0, float(a[s])][a[s + 1] == 'JPY'] for s in range(0, int(n) * 2, 2))))


n = int(input())
jpy = 0
btc = 0
rate = 380000
for _ in range(n):
	(x, y) = input().split()
	if y == 'JPY':
		jpy += int(x)
	else:
		btc += float(x)
print(jpy + btc * rate)


res = 0
for i in range(int(input())):
	(x, u) = input().split()
	x = float(x)
	res += x if u > 'C' else 380000 * x
print(res)


print(sum((380000 ** ('B' in s) * float(s[:-4]) for s in open(0).readlines()[1:])))


n = int(input())
z = 0
for i in range(n):
	(a, b) = input().split()
	if b == 'BTC':
		z += float(a) * 380000
	else:
		z += int(a)
print(z)


def lcm(a, b):
	return a * b // math.gcd(a, b)
MOD = 10 ** 9 + 7
n = int(input())
ans = 0
for i in range(n):
	(x, u) = input().split()
	x = float(x)
	if u == 'JPY':
		ans += x
	else:
		ans += x * 380000
print(ans)


n = int(input())
sm = 0
for i in range(n):
	(x, y) = map(str, input().split())
	if y == 'JPY':
		sm += int(x)
	else:
		sm += float(x) * 380000.0
print(sm)


n = int(input())
ans = 0
for i in range(n):
	ans += eval(input().replace(' ', '*').replace('JPY', '1').replace('BTC', '380000'))
print(ans)


sum = 0
n = int(input())
for _ in range(n):
	(x, c) = input().split()
	x = float(x)
	if c == 'BTC':
		x = x * 380000
		sum += x
	else:
		sum += x
print(sum)


def resolve():
	n = int(input())
	s = 0
	for _ in range(n):
		(x, u) = input().split()
		if u == 'BTC':
			s += float(x) * 380000
		else:
			s += float(x) * 1
	print(s)
resolve()


d = {'JPY': 1, 'BTC': 380000}
s = 0
for _ in [0] * int(input()):
	(x, u) = input().split()
	s += float(x) * d[u]
print(s)


N = int(input())
s = 0
for i in range(N):
	(x, u) = input().split(' ')
	s += (u == 'JPY') * float(x) + (u == 'BTC') * 380000.0 * float(x)
print(s)


n = int(input())
ans = 0
for i in range(n):
	(x, u) = map(str, input().split())
	ans += float(x) * (1 + 379999 * (u == 'BTC'))
print(ans)


N = int(input())
res = 0
while N > 0:
	(x, u) = input().split()
	res += float(x) if u == 'JPY' else float(x) * 380000
	N -= 1
print(res)


n = int(input())
xu = [list(input().split()) for _ in range(n)]
result = 0
for i in range(n):
	if xu[i][1] == 'JPY':
		result += int(xu[i][0])
	else:
		result += float(xu[i][0]) * 380000
print(result)


n = int(input())
ans = 0.0
rate = 380000.0
for i in range(n):
	(a, b) = input().split()
	if b == 'JPY':
		ans += float(a)
	else:
		ans += float(a) * rate
print(ans)


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


n = int(input())
ab = [list(input().split()) for _ in range(n)]
jpy = 0
btc = 0
for i in range(n):
	if ab[i][1] == 'JPY':
		jpy += float(ab[i][0])
	elif ab[i][1] == 'BTC':
		btc += float(ab[i][0])
print(jpy + btc * 380000.0)


n = int(input())
x = []
u = []
yen = 0
bit = 0
for i in range(n):
	(a, b) = input().split()
	x.append(float(a))
	u.append(b)
for i in range(n):
	if u[i] == 'JPY':
		yen += x[i]
	else:
		bit += x[i]
print(yen + 380000 * bit)


N = int(input())
D = {'JPY': 1, 'BTC': 380000}
a = 0
for _ in range(N):
	(v, s) = list(input().split())
	a += float(v) * D[s]
print(a)


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


N = int(input())
X = 0
for n in range(N):
	(x, u) = input().split()
	if u == 'BTC':
		X += float(x) * 380000.0
	else:
		X += int(x)
print(X)


n = int(input())
a = 0
for _ in range(n):
	(x, n) = input().split()
	a += (38 * 10 ** 4) ** (n == 'BTC') * float(x)
print(a)


N = int(input())
x = [0] * N
u = [0] * N
for i in range(N):
	(x[i], u[i]) = list(map(str, input().split()))
ans = 0
for i in range(N):
	if u[i] == 'JPY':
		ans += float(x[i])
	else:
		ans += float(x[i]) * 380000
print(ans)


from typing import List, Tuple

def answer(n: int, xus: List[Tuple[float, str]]) -> float:
	otoshidama = 0
	for (x, u) in xus:
		if u == 'BTC':
			otoshidama += x * 380000.0
		else:
			otoshidama += x
	return otoshidama

def main():
	n = int(input())
	xus = []
	for i in range(n):
		(x, u) = input().split()
		xus.append((float(x), u))
	print(answer(n, xus))

def __starting_point():
	main()
__starting_point()


n = int(input())
x = [input().split() for _ in range(n)]
print(sum([float(x[i][0]) * [1, 380000][x[i][1] == 'BTC'] for i in range(n)]))


xrate = {'JPY': 1, 'BTC': 380000.0}
S = 0
N = int(input())
for i in range(N):
	(x, u) = input().split()
	S += float(x) * xrate[u]
print(S)


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


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


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


N = int(input())
X = [list(map(str, input().split())) for _ in range(N)]
gifts = 0
for i in range(N):
	if X[i][1] == 'JPY':
		gifts += int(X[i][0])
	else:
		gifts += float(X[i][0]) * 380000
print(gifts)


def y():
	for _ in range(int(input())):
		(x, u) = input().split()
		x = float(x)
		yield (x if u == 'JPY' else x * 380000)
print(sum(y()))


n = int(input())
sum = 0
for j in range(n):
	(i, c) = input().split()
	if c == 'BTC':
		sum += float(i) * 380000
	else:
		sum += int(i)
print(sum)


n = int(input())
a = [list(input().split()) for _ in range(n)]
ans = 0
for i in range(n):
	if a[i][1] == 'BTC':
		ans += float(a[i][0]) * 380000
	else:
		ans += float(a[i][0])
print(ans)


N = int(input())
s = 0
for i in range(N):
	x = input()
	s += float(x[:-4]) * (1.0 + (x[-1] == 'C') * 380000.0)
print(s)


N = int(input())
c = 0
for i in range(N):
	(x, u) = map(str, input().split())
	c += float(x) * ((u[0] == 'B') * 379999 + 1)
print(c)


N = int(input())
sum = 0
for n in range(N):
	(x, u) = input().split()
	sum += float(x) * (1 if u == 'JPY' else 380000.0)
print(sum)


bi = 380000
n = 0
for i in range(int(input())):
	(p, s) = input().split()
	if s == 'JPY':
		n += int(p)
	else:
		n += bi * float(p)
print(n)


N = int(input())
x = [list(input().split()) for i in range(N)]
print(sum([float(i[0]) * 380000.0 if i[1] == 'BTC' else float(i[0]) for i in x]))


n = int(input())
res = 0
for i in range(n):
	(x, y) = input().split()
	x = float(x)
	if y == 'BTC':
		x *= 380000.0
	res += x
print(res)


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


import sys
s = 0
input()
for e in sys.stdin:
	(a, b) = e.split()
	s += int(a) if b == 'JPY' else float(a) * 380000
print(s)


N = int(input())
sum = 0
for i in range(N):
	(x, u) = map(str, input().split())
	sum = sum + float(x) * (380000 if u == 'BTC' else 1)
print(sum)


N = int(input())
res = 0
for _ in range(N):
	(x, u) = input().split()
	x = float(x)
	if u == 'BTC':
		x *= 380000
	res += x
print(res)


N = int(input())
d = {'JPY': 1.0, 'BTC': 380000.0}
num = 0
for i in range(N):
	(x, u) = input().split()
	num += float(x) * d[u]
print(num)


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


N = int(input())
ans = 0
for i in range(N):
	(A, B) = input().split()
	if B == 'JPY':
		ans += float(A)
	elif B == 'BTC':
		ans += float(A) * 380000.0
print(ans)


N = int(input())
cnt = 0
for i in range(N):
	(x, v) = input().split()
	cnt += float(x) * (380000.0 if v == 'BTC' else 1.0)
print(cnt)


C = lambda x, y: x if y == 'JPY' else x * 380000
s = 0
n = int(input())
for i in range(n):
	(a, r) = input().split()
	s += C(float(a), r)
print(s)


print(sum((float(s[:-4]) * (s[-4:] > 'C' or 380000) for s in open(0).readlines()[1:])))


n = int(input())
c = 0
for i in range(n):
	(y, t) = input().split()
	if t == 'BTC':
		yen = float(y) * 380000.0
	else:
		yen = float(y)
	c += yen
print(c)


N = int(input())
ans = 0
for i in range(N):
	(x, u) = map(str, input().split())
	if u == 'JPY':
		ans += int(x)
	else:
		x = x.replace('.', '')
		ans += int(x) * 380000 / 10 ** 8
print(str(ans))


n = int(input())
ans = 0
for _ in range(n):
	(v, t) = input().split()
	if t == 'JPY':
		ans += int(v)
	else:
		ans += float(v) * 380000
print(ans)


n = int(input())
m = 0
for i in range(n):
	(x, y) = input().split()
	if y == 'JPY':
		m += int(x)
	else:
		m += float(x) * 380000
print(m)


N = int(input())
L = [input().split() for _ in range(N)]
S = sum([int(x) if u == 'JPY' else float(x) * 380000 for (x, u) in L])
print(S)


c = 0
for _ in [0] * int(input()):
	s = input()
	n = float(s[:-3])
	c += n * (s[-3:] > 'C' or 380000)
print(c)


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	N = int(readline())
	ans = 0
	rate = 380000.0
	for _ in range(N):
		(x, u) = readline().split()
		if u == 'JPY':
			ans += int(x)
		else:
			ans += float(x) * rate
	print(ans)
	return

def __starting_point():
	main()
__starting_point()


N = int(input())
R = 0
for _ in range(N):
	L = input().split()
	R += int(L[0]) if L[1] == 'JPY' else float(L[0]) * 380000
print(R)


N = int(input())
ans = 0
for i in range(N):
	(s, t) = input().split()
	if t[0] == 'J':
		ans += int(s)
	else:
		ans += float(s) * 380000
print(ans)


N = int(input())
j = 0
for i in range(N):
	(x, u) = map(str, input().split())
	x = float(x)
	if u == 'BTC':
		j += x * 380000
	if u == 'JPY':
		j += x
print(j)


a = 0
for i in range(int(input())):
	b = input().split()
	if b[1] == 'JPY':
		a += eval(b[0])
	else:
		a += eval(b[0]) * 380000
print(a)


n = int(input())
xu_list = [input().split() for _ in range(n)]
print(sum([int(x) if u == 'JPY' else float(x) * 380000 for (x, u) in xu_list]))


N = int(input())
l = [0] * N
for i in range(N):
	(x, y) = map(str, input().split())
	l[i] = float(x)
	if y == 'BTC':
		l[i] *= 380000.0
ans = sum(l)
print(ans)


N = int(input())
ans = 0
for _ in range(N):
	xu = input().split()
	if xu[1] == 'JPY':
		ans += int(xu[0])
	else:
		ans += float(xu[0]) * 380000
print(ans + 1e-06)


n = int(input())
money = [input().split() for _ in range(n)]
print(sum([float(x) * {'JPY': 1, 'BTC': 380000}[u] for (x, u) in money]))


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


n = int(input())
Y = 0
for i in range(n):
	(a, b) = input().split()
	if b == 'BTC':
		a = float(a) * 380000
	Y += float(a)
print(Y)


n = int(input())
b = 380000
res = 0
for _ in range(n):
	(x, u) = input().split()
	x = float(x)
	if u == 'BTC':
		x *= b
	res += x
print(res)


n = int(input())
num = 0
for i in range(n):
	(x1, v1) = map(str, input().split())
	if v1 == 'JPY':
		num += int(x1)
	else:
		num += float(x1) * 380000
print(num)


(_, *t) = open(0)
print(sum((380000.0 ** ('B' in s) * float(s[:-4]) for s in t)))


N = int(input())
xu = [input().split() for i in range(N)]
print(sum([float(x) if u == 'JPY' else float(x) * 380000.0 for (x, u) in xu]))


JPY = 1
BTC = 380000
n = int(input())
ans = 0
for i in range(n):
	(x, u) = map(str, input().split())
	if u == 'BTC':
		tmp = float(x) * BTC
	else:
		tmp = int(x) * JPY
	ans += tmp
print(ans)


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


N = int(input())
xu = []
for i in range(N):
	xu.append(list(map(str, input().split())))
a = 0
for i in range(N):
	if xu[i][1] == 'JPY':
		a += float(xu[i][0])
	if xu[i][1] == 'BTC':
		a += float(xu[i][0]) * 380000.0
print(a)


N = int(input())
z = [0, 0]
for i in range(N):
	u = input().split()
	z[u[1] == 'BTC'] += float(u[0])
print(z[0] + z[1] * 380000)


c = 0
for s in open(0).readlines()[1:]:
	n = float(s[:-4])
	c += n * 380000 * (s[-4] < 'J') or n
print(c)


N = int(input())
total = 0
for i in range(N):
	(x, u) = input().split()
	total = total + float(x) * [1, 380000.0][u == 'BTC']
print(total)


a = int(input())
b = 0
for c in range(a):
	d = input().split()
	if d[1] == 'BTC':
		b = b + 380000 * float(d[0])
	else:
		b = b + int(d[0])
print(b)


n = int(input())
total = 0
for i in range(n):
	(value, currency) = input().split()
	if currency == 'JPY':
		total += float(value)
	else:
		total += float(value) * 380000
print(total)


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


import sys
stdin = sys.stdin

def ns():
	return stdin.readline().rstrip()

def ni():
	return int(stdin.readline().rstrip())

def nm():
	return list(map(int, stdin.readline().split()))

def nl():
	return list(map(int, stdin.readline().split()))

def main():
	n = ni()
	m = [tuple(input().split()) for _ in range(n)]
	btc_to_jpy = 380000
	ans = 0
	for (price, kind) in m:
		if kind == 'JPY':
			ans += int(price)
		else:
			ans += btc_to_jpy * float(price)
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
print(sum((float(x) * 380000.0 ** int(u == 'BTC') for (x, u) in [input().split() for _ in range(n)])))


N = int(input())
b_to_y = 380000
ans = 0
for i in range(N):
	(p, unit) = input().split()
	if unit == 'JPY':
		ans += int(p)
	if unit == 'BTC':
		ans += b_to_y * float(p)
print(ans)


n = int(input())
s = 0
for i in range(n):
	(a, b) = input().split(' ')
	a = float(a)
	s += a * {'JPY': 1, 'BTC': 380000}[b]
print(s)


n = int(input())
xu = [list(input().split()) for _ in range(n)]
money = 0
for k in xu:
	if k[1] == 'JPY':
		money += float(k[0])
	else:
		money += float(k[0]) * 380000
print(money)


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


n = int(input())
s = 0
f = lambda x: float(x[0]) if x[1] == 'JPY' else float(x[0]) * 380000.0
print(sum([f(input().split()) for _ in range(n)]))


def mapt(fn, *args):
	return tuple(map(fn, *args))

def Vector(line):
	return mapt(Atom, line.split(' '))

def Atom(segment):
	try:
		return float(segment)
	except ValueError:
		try:
			int(segment)
		except ValueError:
			return segment

def main():
	n = int(input())
	data = [Vector(input()) for _ in range(n)]
	total = 0
	for (amount, currency) in data:
		if currency == 'JPY':
			total += amount
		else:
			total += amount * 380000
	print(total)
main()


print(sum([float(x) * 380000 if y == 'BTC' else int(x) for i in range(int(input())) for (x, y) in [input().split()]]))


n = int(input())
ans = 0
d = {'JPY': 1, 'BTC': 380000.0}
for _ in range(n):
	(a, b) = input().split()
	ans += float(a) * d[b]
print(ans)


n = int(input())
m = [list(map(str, input().split())) for i in range(n)]
cnt = 0
for i in range(n):
	m[i][0] = float(m[i][0])
	if m[i][1] == 'BTC':
		m[i][0] *= 380000.0
	cnt += m[i][0]
print(cnt)


n = int(input())
x_list = []
u_list = []
for i in range(n):
	(x, u) = input().split()
	x_list.append(float(x))
	u_list.append(u)
sum = 0
for i in range(n):
	if u_list[i] == 'JPY':
		sum += x_list[i]
	else:
		sum += x_list[i] * 380000.0
print(sum)


n = int(input())
values = [input().split() for i in range(n)]
print(sum([float(value) * {'JPY': 1, 'BTC': 380000.0}[unit] for (value, unit) in values]))


n = int(input())
ans = 0
for _ in range(n):
	(x, u) = input().split()
	c = 380000 if u == 'BTC' else 1
	ans += float(x) * c
print(ans)


N = int(input())
P = 0
for i in range(N):
	(A, B) = input().split()
	if B == 'JPY':
		P += int(A)
	else:
		P += float(A) * 380000
print(P)


n = int(input())
data = [input().split() for i in range(n)]
ans = 0
for i in range(n):
	if data[i][1] == 'JPY':
		ans += int(data[i][0])
	else:
		ans += float(data[i][0]) * 380000
print(ans)


a = int(input())
su = 0
for i in range(a):
	(n, m) = input().split()
	if m == 'JPY':
		su += int(n)
	else:
		su += float(n) * 380000
print(su)


a = int(input())
b = [input().split() for i in range(a)]
c = 0
for i in range(a):
	if b[i][1] == 'JPY':
		c = c + int(b[i][0])
	if b[i][1] == 'BTC':
		c = c + float(b[i][0]) * 380000
print(c)


n = int(input())
s = 0
for i in range(n):
	(a, d) = input().split()
	if d == 'JPY':
		s += float(a)
	else:
		s += float(a) * 380000
print(s)


n = int(input())
sum = 0
for i in range(n):
	a = input().split()
	sum += float(a[0]) * (1 if a[1] == 'JPY' else 380000)
print(sum)


n = int(input())
s = 0
for i in range(n):
	(am, un) = input().split(' ')
	s += float(am) if un == 'JPY' else float(am) * 380000.0
print(s)


n = int(input())
x = []
for i in range(n):
	(a, b) = input().split()
	if b == 'JPY':
		x.append(int(a))
	else:
		x.append(float(a) * 380000)
print(sum(x))


N = int(input())
btc_a = 380000.0
btc_b = btc_a / 10 ** 8
ans = 0.0
for i in range(N):
	(x, n) = input().split()
	if n == 'JPY':
		ans += int(x)
	else:
		(a, b) = map(int, x.split('.'))
		ans += a * btc_a
		ans += b * btc_b
print(ans)


n = int(input())
o = 0
for i in range(n):
	(x, u) = input().split()
	if u == 'BTC':
		o += float(x) * 380000.0
	else:
		o += int(x)
print(o)


n = int(input())
a = 0
for i in range(n):
	(v, c) = input().split()
	v = float(v)
	if c == 'JPY':
		a += v
	else:
		a += v * 380000.0
print(a)


def readinput():
	n = int(input())
	dama = []
	for _ in range(n):
		(a, b) = input().split()
		dama.append((a, b))
	return (n, dama)

def main(n, dama):
	sum = 0.0
	for (x, u) in dama:
		if u == 'JPY':
			sum += int(x)
		else:
			sum += float(x) * 380000.0
	return sum

def __starting_point():
	(n, dama) = readinput()
	ans = main(n, dama)
	print(ans)
__starting_point()


N = int(input())
moneys = [tuple(map(str, input().split())) for _ in range(N)]
rate = 380000
total = 0
for money in moneys:
	(x, u) = money
	x = float(x)
	if u == 'JPY':
		total += x
	else:
		total += x * rate
print(total)


n = int(input())
print(sum((float(x) * (int(u == 'BTC') * 379999 + 1) for (x, u) in [input().split() for _ in range(n)])))


n = int(input())
dic = {'JPY': 1, 'BTC': 380000}
ans = 0
for i in range(n):
	(x, u) = input().split()
	ans += float(x) * dic[u]
print(ans)


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


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LSS():
	return input().split()

def resolve():
	N = I()
	xu = [LSS() for _ in range(N)]
	ans = 0
	for (x, u) in xu:
		if u == 'JPY':
			ans += int(x)
		else:
			ans += float(x) * 380000
	print(ans)

def __starting_point():
	resolve()
__starting_point()


N = int(input())
m = 0.0
for _ in range(N):
	(v, t) = input().split()
	m += float(v) if t == 'JPY' else float(v) * 380000.0
print(m)


n = int(input())
list_bonus = [[s for s in input().split()] for j in range(0, n)]
ans = 0.0
for i in range(0, n):
	if list_bonus[i][1] == 'JPY':
		ans += float(list_bonus[i][0])
	else:
		ans += float(list_bonus[i][0]) * 380000.0
print(ans)


N = int(input())
X = []
U = []
for _ in range(N):
	(x, u) = input().split()
	X.append(float(x))
	U.append(u)
ans = 0
for (x, u) in zip(X, U):
	if u == 'JPY':
		ans += x
	else:
		ans += x * 380000.0
print(ans)


n = int(input())
l = [list(map(str, input().split())) for i in range(n)]
ans = 0
for i in range(n):
	if l[i][1] == 'JPY':
		ans += int(l[i][0])
	else:
		ans += float(l[i][0]) * 380000.0
print(ans)


n = 0
for _ in range(int(input())):
	(x, y) = input().split()
	if y == 'BTC':
		n += float(x) * 380000.0
	else:
		n += float(x)
print(n)


ans = 0
for _ in range(int(input())):
	(X, U) = input().split()
	ans += float(X) if U == 'JPY' else float(X) * 380000
print(ans)


n = int(input())
print(sum(map(lambda x: float(x[0]) * (1 if x[1] == 'JPY' else 380000.0), [input().split() for i in range(n)])))


n = int(input())
r = 0.0
for i in range(n):
	(m, t) = input().split()
	if t == 'JPY':
		r += float(m)
	else:
		r += float(m) * 380000.0
print(r)


N = int(input())
ans = 0
for _ in range(N):
	(x, u) = input().split()
	x = float(x)
	if u == 'BTC':
		ans += 380000 * x
	else:
		ans += x
print(ans)


n = int(input())
jpy = 0
btc = 0
for i in range(n):
	(a, b) = input().split()
	if b == 'JPY':
		jpy += int(a)
	else:
		btc += int(float(a) * 100000000)
print(jpy + btc * 38 / 10000)