object Main extends App {
  import scala.io.StdIn._

  val n = readInt
  val scores = Array.tabulate(n){_ ⇒
    val Array(x, y) = readLine.trim.split(' ')
    (x, y)
  }
  println(
    (scores.collect{
      case (x, "BTC") ⇒ x.toDouble * 380000
    }.sum) + (scores.collect{
      case (x, "JPY") ⇒ x.toInt
    }.sum)
  )
}