100 atcoder#ABC119B. [ABC119B] Digital Gifts

[ABC119B] Digital Gifts

Score : 200200 points

Problem Statement

Takahashi received otoshidama (New Year's money gifts) from NN of his relatives.

You are given NN values x1,x2,...,xNx_1, x_2, ..., x_N and NN strings u1,u2,...,uNu_1, u_2, ..., u_N as input. Each string uiu_i is either JPY or BTC, and xix_i and uiu_i represent the content of the otoshidama from the ii-th relative.

For example, if x1=x_1 = 10000 and u1=u_1 = JPY, the otoshidama from the first relative is 1000010000 Japanese yen; if x2=x_2 = 0.10000000 and u2=u_2 = BTC, the otoshidama from the second relative is 0.10.1 bitcoins.

If we convert the bitcoins into yen at the rate of 380000.0380000.0 JPY per 1.01.0 BTC, how much are the gifts worth in total?

Constraints

  • 2N102 \leq N \leq 10
  • ui=u_i = JPY or BTC.
  • If ui=u_i = JPY, xix_i is an integer such that 1xi1081 \leq x_i \leq 10^8.
  • If ui=u_i = BTC, xix_i is a decimal with 88 decimal digits, such that 0.00000001xi100.000000000.00000001 \leq x_i \leq 100.00000000.

Input

Input is given from Standard Input in the following format:

NN

x1x_1 u1u_1

x2x_2 u2u_2

::

xNx_N uNu_N

Output

If the gifts are worth YY yen in total, print the value YY (not necessarily an integer).

Output will be judged correct when the absolute or relative error from the judge's output is at most 10510^{-5}.

2
10000 JPY
0.10000000 BTC
48000.0

The otoshidama from the first relative is 1000010000 yen. The otoshidama from the second relative is 0.10.1 bitcoins, which is worth 38000.038000.0 yen if converted at the rate of 380000.0380000.0 JPY per 1.01.0 BTC. The sum of these is 48000.048000.0 yen.

Outputs such as 48000 and 48000.1 will also be judged correct.

3
100000000 JPY
100.00000000 BTC
0.00000001 BTC
138000000.0038

In this case, outputs such as 138001000 and 1.38e8 will also be judged correct.