sub c{($t,$p,@r)=@_;while($v=pop@$p and$t>0) {while($t>=$v){push@r,$v;$t=sprintf"%f",$t-$v}}@r}