function main(arg) {
	var btcRate = 380000
	arg = arg.split("\n")

	var N = arg.shift()

	arg = arg.map(e => {
		tmp = e.split(" ")
		tmp[0] = Number(tmp[0])
		return tmp
	})

	var result = 0

	for (var i = 0; i < arg.length; i++) {
		// console.log(arg[i][1]) //JPY
		if (arg[i][1] == "JPY") {
			result += Number(arg[i][0])
		} else if (arg[i][1] == "BTC") {
			result += Number(arg[i][0]) * btcRate
		}
	}

	console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));