yuki = gets.to_i other = gets.to_i num = gets.to_i list = [] num.times do reserve = gets.to_i list << reserve end a = list.size b = list.uniq.size c = a - b puts (yuki + other) * c