p=[int(input()) for i in '11'] n=int(input()); r=[int(input()) for i in '1'*n] print((len(r)-len(set(r)))*sum(p))