P1 = int(input()) P2 = int(input()) n = int(input()) R = [int(input()) for _ in range(n)] R_set = list(set(R)) print((P1+P2) * (len(R) - len(R_set)))