function Main(input){
input = input.split("\n");
var sum = 0;
for(var i=1;i<input.length;i++){
	var mem = input[i].split(" ");
	if(mem[1]=="JPY"){
		sum += Number(mem[0])
	}else{
		sum += mem[0]*380000;
	}
	console.log(sum);
}
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());