P1 = int(input()) P2 = int(input()) N = int(input()) R = [int(input()) for i in range(N)] ans = 0 for i in range(1, 1000): ans += max(0, R.count(i) - 1) * (P1 + P2) print(ans)