a=int(input()) b=int(input()) c=[int(input()) for i in range(int(input()))] s=0 print((a+b)*(len(c)-len(set(c))))