p1 = int(input()) p2 = int(input()) n = int(input()) r = [int(input()) for i in range(n)] d = len(r) - len(set(r)) print(d*(p1+p2))