#2345678901234567890123456789012345678901234567890123456789012345678 sub c{($t,$p)=@_;for(reverse@$p){until($t<$_){push@r,$_;$t-=$_}}@r}