P1 = int(input()) P2 = int(input()) N = int(input()) ans = 0 R = [False for _ in range(1000)] for _ in range(N): r = int(input()) if R[r]: ans += P1 + P2 R[r] = True print(ans)