def dfs(xs, goal) if xs.size == 1 x = xs[0] return (goal == x) end x = xs.shift y = xs.shift can = [] can << x + y can << x - y can << y - x can << x * y can << y / x if x != 0 can << x / y if y != 0 can.each do |z| return true if dfs([z] + xs, goal) end false end def solve(n, goal) a = (1..n).to_a dfs a, goal end m, n = gets.chomp.split.map(&:to_i) puts solve(m, n) ? :Possible : :Impossible