p1 = int(input()) p2 = int(input()) n = int(input()) book_room = {input() for __ in range(n)} print((p1 + p2) * (n - len(book_room)))