using System; using System.Collections.Generic; using System.Linq; public class Amatsuki{ public static void Main(){ var cost = int.Parse(Console.ReadLine()); cost += int.Parse(Console.ReadLine()); var roomCount = int.Parse(Console.ReadLine()); var duplicate = 0; var check = ""; for(var i = 0; i < roomCount; i++){ var newRoom = "_" + Console.ReadLine(); if(check.IndexOf(newRoom) < 0){ check += newRoom; } else{ duplicate++; } } Console.WriteLine(cost * duplicate); } }