# import sys; input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): P1 = int(input()) P2 = int(input()) D = defaultdict(int) N = int(input()) for i in range(N): R = int(input()) D[R] += 1 ans = (P1 + P2) * (N - len(D)) print(ans) if __name__ == '__main__': main()