p1 = int(input()) p2 = int(input()) n = int(input()) r=dict() for i in range(n): a =input() if a in r: r[a] +=1 else: r[a] = 1 b=sum(r.values()) - len(r) print(b * (p1+p2))