-- 入力を (金額, 単位) のリストとしてまとめる
-- 単位によって円の金額を計算して足しあげる

import Control.Applicative
import Control.Monad as M

main :: IO ()
main = do
  n <- getLine
  gifts <- M.replicateM (read n) (words <$> getLine)
  putStrLn $ show (solve gifts)

type Gift = (Double, String)

strToGift :: [String] -> Gift
strToGift [value, unit] = (read value :: Double, unit)

strToGifts :: [[String]] -> [Gift]
strToGifts = map strToGift

giftToValue :: Gift -> Double
giftToValue (value, unit) = case unit of
  "JPY" -> value
  "BTC" -> 380000.0 * value

solve :: [[String]] -> Double
solve = sum . map giftToValue . strToGifts
