ryoukin = int(input()) hurikae = int(input()) kazu = int(input()) heya = [] #からのリスト用意 for i in range(kazu): bangou = int(input()) heya.append(bangou) heya.sort() count = 0 if kazu == 1: print(0) else: for k in range(kazu - 1): if heya[k] == heya[k+1]: count += 1 print((ryoukin + hurikae) * count)