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