import java.util.*;
import java.text.*;
public class cpromC {
public static void main(String [] args) {
Scanner scn = new Scanner(System.in);
while(scn.hasNext()) {
String accountNum = scn.next();
String custCode = scn.next();
char code = custCode.charAt(0);
double total = 0.0;
if(code == \'R\' || code == \'r\') {
int numPremiumChannel = scn.nextInt();
total = 25.00 + (numPremiumChannel * 7.5);
}
else if(code == \'B\' || code == \'b\') {
int numPremiumChannel = scn.nextInt();
int numBasicService = scn.nextInt();
double basic = 0.0;
if(numBasicService <= 10) {
basic = 75.0;
}
else {
basic = 75.0 + ((numBasicService-10)*5);
}
total = 15.0 + (50.0 * numPremiumChannel) + basic;
}
DecimalFormat df = new DecimalFormat("0.00");
System.out.println(accountNum +"\\n" +df.format(total));
}
}
}