
import Data.List.Split

rate :: Double
rate = 380000

bitToJPY :: Double -> Double
bitToJPY bit = do
  bit * rate


sumup :: [(Double, String)] -> Double
sumup tuples = do
  let func = \tuple -> case snd tuple　of
                    "BIT" -> bitToJPY $　fst tuple
                    "JPY" -> fst tuple
  let result = map func tuples
  sum result
  

main = do
  p <- getLine
  let prices = map read $ words p :: [Double]
  t <- getLine
  let types = words t
  let tuples = zip prices types
  print $ show $ sumup tuples