p1 = int(input()) p2 = int(input()) N =int(input()) a = [] for i in range(N): a.append(int(input())) P = p1+p2 S = set(a) print( P* (N - len(S)))