gets NS = gets.split.map(&:to_i).sort SUM = NS.inject(&:+) Q, R = SUM.divmod(2) if R == 0 then h = {} h[0] = true while n = NS.shift do add = {} h.each do |k, v| next if k + n > Q add[k + n] = true end h.update add end puts h[Q] ? "possible" : "impossible" else puts "impossible" end