p1 = int(input()) p2 = int(input()) n = int(input()) r = [int(input()) for i in range(n)] from collections import Counter a = list(Counter(r).values()) a_c = [1]*len(a) print(sum([(p1+p2)*(i-j) for i,j in zip(a,a_c)]))