using System; using System.Collections.Generic; namespace lecture { class MainClass { public static void Main(string[] args) { int P = int.Parse(Console.ReadLine()); P += int.Parse(Console.ReadLine()); int N = int.Parse(Console.ReadLine()); Dictionary roomNumber = new Dictionary(); for (int i = 0; i < N; i++) { string R = Console.ReadLine(); if (roomNumber.ContainsKey(R)) { roomNumber[R]++; } else { roomNumber[R] = 1; } } int count = 0; foreach (int cnt in roomNumber.Values) { if (cnt > 1) { count += cnt - 1; } } Console.WriteLine(count * P); } } }