import sequtils,math proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': return result = 10 * result + k.ord - '0'.ord let n = scan() let W = newSeqWith(n,scan()) let wSum = W.sum() if wSum mod 2 == 1 : quit "impossible",0 let m = wSum div 2 var dp = newSeq[bool](m + 1) dp[0] = true for w in W: for i in countdown(m-w,0): if dp[i] : dp[i + w] = true if dp[m] : quit "possible",0 quit "impossible",0