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