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