p1 = int(input()) p2 = int(input()) n = int(input()) c = 0 ls = [] for i in range(n): r = int(input()) if r in ls: c += 1 else: ls.append(r) print(c*(p1+p2))