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