a=int(input()) b=int(input()) d=[] for i in range(int(input())): d.append(int(input())) e=set(d) c=0 for i in e: c+=d.count(i)-1 print(c*(a+b))