from collections import Counter P=int(input()) Q=int(input()) N=int(input()) R=[int(input()) for i in range(N)] C=Counter(R) ANS=0 for c in C: ANS+=(C[c]-1)*(P+Q) print(ANS)