p = int(input()) + int(input()) n = int(input()) r = [int(input())] for i in range(n): s = set(r) print((len(r)-len(s))*p)