p1 = int(input()) p2 = int(input()) n = int(input()) lst = [] ans = 0 for i in range(n): r = int(input()) if r in lst: ans += p1 + p2 else: lst.append(r) print(ans)