c = 0 a = int(input()) b = int(input()) z = int(input()) reserved =[] for x in range(z): new = input() if reserved.count(new) >= 1: c += 1 else: reserved.append(new) print(c*(a+b))