object Main extends App {
  val N = io.StdIn.readLine.toInt

  val xu: Seq[Array[String]] = for (i <- 1 to N) yield io.StdIn.readLine.split(' ')

  val out = xu.map {
    case Array(n,"JPY") => n.toInt
    case Array(n,"BTC") => 380000 * n.toDouble
  }.sum

  println(out)
}