p1 = int(input()) p2 = int(input()) n = int(input()) books = [] for i in range(n): books.append(int(input())) print((n - len(set(books))) * (p1 + p2))