import java.util.*;

public class Main {
    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(); // consume newline

        if (n <= 0) {
            System.out.println("Invalid input");
            return;
        }

        String[] types = new String[n];
        int[] powers = new int[n];
        int[] hours = new int[n];

        for (int i = 0; i < n; i++) {
            if (!sc.hasNextLine()) {
                System.out.println("Invalid input");
                return;
            }
            String line = sc.nextLine().trim();
            if (line.isEmpty()) {
                System.out.println("Invalid input");
                return;
            }

            String[] parts = line.split("\\s+");
            if (parts.length != 3) {
                System.out.println("Invalid input");
                return;
            }

            String type = parts[0];
            int power, hr;
            try {
                power = Integer.parseInt(parts[1]);
                hr = Integer.parseInt(parts[2]);
            } catch (NumberFormatException e) {
                System.out.println("Invalid input");
                return;
            }

            if (power <= 0 || hr <= 0) {
                System.out.println("Invalid input");
                return;
            }

            if (!type.equals("WashingMachine") &&
                !type.equals("Refrigerator") &&
                !type.equals("AirConditioner")) {
                System.out.println("Invalid input");
                return;
            }

            types[i] = type;
            powers[i] = power;
            hours[i] = hr;
        }

        // All inputs valid — compute and print
        for (int i = 0; i < n; i++) {
            double consumption;
            if (types[i].equals("WashingMachine")) {
                consumption = powers[i] * (double) hours[i];
            } else if (types[i].equals("Refrigerator")) {
                consumption = powers[i] * (double) hours[i] * 0.8;
            } else { // AirConditioner
                consumption = powers[i] * (double) hours[i] * 1.5;
            }
            System.out.printf(Locale.US, "%.2f\n", consumption);
        }
    }
}
