p, q, n = io.read("*n", "*n", "*n") t = {} tot = 0 for i = 1, n do a = io.read("*n") if(t[a] ~= nil) then tot = tot + 1 else t[a] = true end end print(tot * (p + q))