P = int(input()) + int(input()) N = int(input()) L = [] x = 0 for _ in range(N): r = int(input()) if r in L: x += 1 else: L += [r] print(P * x)