P = int(input()) + int(input()) N = int(input()) L = [int(input()) for _ in range(N)] print(P * (len(L)-len(set(L))))