import java.util.Scanner;

public class ApplianceCostCalculator {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());

        for (int i = 0; i < n; i++) {
            String[] parts = sc.nextLine().split(" ");
            String appliance = parts[0];
            double power = Double.parseDouble(parts[1]);
            double hours = Double.parseDouble(parts[2]);

            double multiplier = 1.0;

            if (appliance.equals("Refrigerator")) {
                multiplier = 0.8;
            } else if (appliance.equals("AirConditioner")) {
                multiplier = 1.5;
            } // WashingMachine or other → default 1.0

            double cost = power * hours * multiplier;

            System.out.printf("%.2f\n", cost);
        }

        sc.close();
    }
}
