def main(): P1 = int(input()) P2 = int(input()) N = int(input()) s = [input() for i in range(N)] print((P1+P2)*(N-len(set(s)))) if __name__ == '__main__': main()