P1=int(input()) P2=int(input()) N=int(input()) R=[0]*N count=0 for i in range(N): R[i]=int(input()) R.sort() for i in range(N-1): if R[i]==R[i+1]: count+=1 print(count*(P1+P2))