using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace template { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()) + int.Parse(Console.ReadLine()); int n = int.Parse(Console.ReadLine()); bool[] used = new bool[2000]; int ret = 0; for (int i = 0; i < n; i++) { int x = int.Parse(Console.ReadLine()); if (!used[x]) used[x] = true; else ret++; } Console.WriteLine(a * ret); } } }