using System; using System.Collections.Generic; using System.Linq; class Solution { static void Main() { var p1 = int.Parse(Console.ReadLine()); var p2 = int.Parse(Console.ReadLine()); var n = int.Parse(Console.ReadLine()); var pay = p1 + p2; var bocking = new HashSet(); var count = 0; for (int i = 0; i < n; i++) { var room = int.Parse(Console.ReadLine()); if (bocking.Contains(room)) { count++; } else { bocking.Add(room); } } Console.WriteLine(pay * count); } }