P1 = int(input()) P2 = int(input()) N = int(input()) R = [int(input()) for _ in range(N)] S = set() ans = 0 for r in R: if r in S: ans += P1+P2 else: S.add(r) print(ans)