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