
fun main(args:Array<String>) {
    val N = readLine()!!.toInt()
    val xu = (1..N).map {
        val s = readLine()!!.split(" ")
        Pair(s[0],s[1])
    }
    xu.map{
        when(it.second) {
            "JPY" -> it.first.toDouble()
            "BTC" -> it.first.toDouble() * 380000.0
            else -> {
                0.0
            }
        }
    }.fold(0.0) {sum,ele-> sum+ele}.run(::println)
}
 