import collections yuki_money = int(input()) another_money = int(input()) n = int(input()) r_list = [int(input()) for i in range(n)] r_clc = collections.Counter(r_list) c = 0 for cur_key in r_clc.keys(): rsv = r_clc[cur_key] c += (yuki_money + another_money) * (rsv - 1) res = c print(res)