def f(n, weights) sum = weights.inject(0, :+) return false if sum.odd? dp = {} g = lambda{|i, w| dp[[i,w]] ||= if w == 0 true elsif i == n false elsif w < weights[i] g.(i+1, w) else g.(i+1, w) || g.(i+1, w-weights[i]) end } g.(0, sum/2) end N = gets.to_i W = gets.split.take(N).map(&:to_i) puts f(N, W) ? :possible : :impossible