import java.util.*;

public class PowerConsumption {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        if (!sc.hasNextInt()) {
            System.out.println("Invalid input");
            return;
        }

        int n = sc.nextInt();
        sc.nextLine();

        if (n <= 0) {
            System.out.println("Invalid input");
            return;
        }

        double[] results = new double[n];

        for (int i = 0; i < n; i++) {
            if (!sc.hasNextLine()) {
                System.out.println("Invalid input");
                return;
            }
            String[] parts = sc.nextLine().trim().split("\\s+");

            if (parts.length != 3) {
                System.out.println("Invalid input");
                return;
            }

            String type = parts[0];
            int power, hours;

            try {
                power = Integer.parseInt(parts[1]);
                hours = Integer.parseInt(parts[2]);
            } catch (NumberFormatException e) {
                System.out.println("Invalid input");
                return;
            }

            if (power <= 0 || hours <= 0) {
                System.out.println("Invalid input");
                return;
            }

            double consumption;
            switch (type) {
                case "WashingMachine":
                    consumption = power * hours;
                    break;
                case "Refrigerator":
                    consumption = power * hours * 0.8;
                    break;
                case "AirConditioner":
                    consumption = power * hours * 1.5;
                    break;
                default:
                    System.out.println("Invalid input");
                    return;
            }
            results[i] = consumption;
        }

        // ✅ Only print results if ALL inputs were valid
        for (double val : results) {
            System.out.printf("%.2f\n", val);
        }
    }
}