d = int(input()) + int(input()) R = [0]*1000 c = 0 for _ in range(int(input())): a = int(input()) if R[a]: c += 1 R[a] = 1 print(c*d)