p1 = int(input()) p2 = int(input()) N = int(input()) R1 = [] for i in range(N): R1.append(int(input())) visited = [False for i in range(1000)] res = 0 for v in R1: if (visited[v]): res += p1 + p2 visited[v] = True print(res)