
class Price(value: Double, currency: String) {
  val bitCoinToYenRate = 380000

  def toYen(): Double = {
    currency match {
      case "JPY" => value
      case "BTC" => value * bitCoinToYenRate
      case _ => throw new IllegalStateException(s"invalid currency received: ${currency}")
    }
  }
}

import io.StdIn._
import scala.io.Source.stdin

object Main extends App {

  val otosidamaCount = readInt()

  val lines = stdin.getLines()
  val jpyValues = lines.map { line =>
    println(line)
    val splited = line.split(' ')
    new Price(splited(0).toDouble, splited(1)).toYen()
  }

  println(jpyValues.sum)
}
