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