from collections import Counter PP=int(input()) + int(input()) N = int(input()) R = [int(input()) for i in range(N)] ans = 0 counter = Counter(R) for Rn, cnt in counter.most_common(): if cnt > 0 : ans += ((cnt-1)*PP) print(ans)