inputs = STDIN.readlines.map(&:chomp) N = inputs[0].to_i Ws = inputs[1].split(/\s+/).map(&:to_i) total = Ws.inject(:+) unless total % 2 == 0 puts 'impossible' exit end goal = total / 2 memos = Array.new(N + 1) { Hash.new } def dp(i, g, memos) if g == 0 res = true elsif i == N || g < 0 res = false elsif memos[i].key?(g) res = memos[i][g] else res = dp(i + 1, g, memos) || dp(i + 1, g - Ws[i], memos) end memos[i][g] = res end puts dp(0, goal, memos) ? 'possible' : 'impossible'