P1 = int(input()) P2 = int(input()) N = int(input()) R = [int(input()) for _ in range(N)] a = [] for k in R: if k not in a: a.append(k) else: continue K = len(a) A = (N - K) * (P1 + P2) print(A)