import collections a=int(input()) b=int(input()) n=int(input()) c=[int(input()) for i in range(n)] s=0 for i,j in collections.Counter(c).items(): if j>1: s+=(a+b)*(j-1) print(s)