import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readLn >>= flip replicateM getLine >>= print . solve . map convf
    where
        convf s = (x, u)
            where
                x = read xs
                [xs, u] = words s

solve :: [(Double, String)] -> Double
solve = sum . map convf
    where
        convf (x, "BTC") = x * 380000
        convf (x, _) = x 

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine