G, Z = [gets,gets].map(&:to_i) A = gets.to_i W = Array(A) {|_| gets } V = W.uniq puts [G,Z,A,W*",",V*","] puts (A - V.size - 1) * (G + Z)