P1 = int(input()) P2 = int(input()) N = int(input()) r = list() x = set() for i in range(N): Ri = int(input()) r.append(Ri) x.add(Ri) R = len(r) X = len(x) lost = (P1+P2)*(R-X) print(lost)