def main(): P1 = int(input()) P2 = int(input()) N = int(input()) reservation = [] for i in range(N): reservation.append(input()) loss = (len(reservation) - len(set(reservation))) * (P1 + P2) print(loss) if __name__ == '__main__': main()