import Control.Monad

main = do
    n <- readLn
    ss <- map (toTuple . words) <$> replicateM n getLine
    print $ sum $ map toJPY ss

toTuple :: [String] -> (Double, String)
toTuple (n:t:xs) = (read n, t)

toJPY :: (Double, String) -> Integer
toJPY (n, t)
    | t == "BTC" = round (n * 380000.0)
    | t == "JPY" = round n