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