from collections import defaultdict sum_p = int(input()) + int(input()) m = defaultdict(int) for _ in range(int(input())): m[int(input())] += 1 print((sum(m.values()) - len(m)) * sum_p)