object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').toIndexedSeq).tail
  val jpy = ls.map{e =>
    //println(e.toSeq)
    if(e(1) == "JPY") e(0).toDouble else e(0).toDouble*380000.0
  }
  val ret = jpy.sum
  println(ret)
}
