readD :: String -> Double
readD = read

main = do
    s <- words<$>getContents
    print $ solve s

solve :: [String] -> Double
solve (n:s) = compute s

compute [] = 0
compute (a:x:s) = convert [a,x] + compute s

convert [a,x] = if x == "BTC" then b*380000 else b
 where
  b = readD a