import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import Counter p1,p2,n,*R = map(int,read().split()) p = p1 + p2 counter = Counter(R) x = sum(x - 1 if x > 1 else 0 for x in counter.values()) answer = p * x print(answer)