from collections import Counter P1 = int(input()) P2 = int(input()) N = int(input()) R = [int(input()) for _ in range(N)] rc = Counter(R) ans = 0 for v in rc.values(): ans += (P1+P2)*(v-1) print(ans)