import Data.Array import Data.Maybe (fromJust) main = do n <- read <$> getLine ws <- map read . words <$> getLine let sumOfWs = sum ws table = listArray ((1,1),(n,div sumOfWs 2)) $ repeat Nothing putStrLn $ if even sumOfWs && snd (partition table n (div sumOfWs 2) ws) then "possible" else "impossible" partition table n m [] | m == 0 = (table,True) | otherwise = (table,False) partition table n m (w:ws) | m < 0 = (table,False) | m == 0 = (table,True) | otherwise = case table!(n,m) of Just b -> (table,b) Nothing -> (table2//[((n,m),Just result)],result) where (table1,r1) = partition table (n-1) m ws (table2,r2) = partition table1 (n-1) (m-w) ws result = r1 || r2