function Main(input) {
	var num = input.split(/n|\s/);
	for(var n=0; n<num.length; n++){ num[n]=parseInt(num[n]); }
	var output;
  	var count = 0;
 
 for(i=0;i<num[0];i++){
	if(num[i+2]="JPY"){
		count=num[i+1]+count;
	}else if(num[i+2]="BTC"){
		count=num[i+3]*380000+count;
	}
   i=i+1;
 }
	//出力
	console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));