import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String dring = scan.nextLine(); String city = scan.nextLine(); int num = Integer.parseInt(scan.nextLine()); double money = 0; if (city.equals("Sofia")){ if (dring.equals("coffe")){ money = 0.5 * num; System.out.println(money); } else if (dring.equals("water")){ money = 0.8 * num; System.out.println(money); } else if (dring.equals("beer")){ money = 1.2 * num; System.out.println(money); } else if (dring.equals("sweets")){ money = 1.45 * num; System.out.println(money); } else if (dring.equals("peanuts")){ money = 1.6 * num; System.out.println(money); } } else if (city.equals("Plovdiv")){ if (dring.equals("coffe")){ money = 0.4 * num; System.out.println(money); } else if (dring.equals("water")){ money = 0.7 * num; System.out.println(money); } else if (dring.equals("beer")){ money = 1.15 * num; System.out.println(money); } else if (dring.equals("sweets")){ money = 1.3 * num; System.out.println(money); } else if (dring.equals("peanuts")){ money = 1.5 * num; System.out.println(money); } } else if (city.equals("Varna")){ if (dring.equals("coffe")){ money = 0.45 * num; System.out.println(money); } else if (dring.equals("water")){ money = 0.7 * num; System.out.println(money); } else if (dring.equals("beer")){ money = 1.1 * num; System.out.println(money); } else if (dring.equals("sweets")){ money = 1.35 * num; System.out.println(money); } else if (dring.equals("peanuts")){ money = 1.55 * num; System.out.println(money); } } } }