class Problem0586: def solve(this): p1 = int(input()) p2 = int(input()) n = int(input()) res = {} cnt = 0 for i in range(n): k = int(input()) if res.get(k, 0) == 0: res[k] = 1 else: cnt += p1 + p2 print(cnt) if __name__ == "__main__": problem = Problem0586() problem.solve()