f[]=[] f(x:s)=[[x]]++map(x:)(f s) g[]=[] g(x:s)=f(x:s)++g s h[a]=a h(a:b)|sum a>sum(b!!0)=h(a:tail b)|1>0=h b i s=filter((>=putStrLn.unwords.map show.h.i.words>>m