i=input p1,p2=int(i()),int(i()) N=int(i()) R=[int(i()) for _ in range(N)] print((len(R) - len(set(R)))*(p1+p2))