@x=@_;my%c;$e=sub{my$v=pop;$c{$v}//=$v==0||$v>0&&grep&$e($v-$_),@x};$t=$s=0;{&$e(++$t)?$t-$s>=$x[0]&&last:($s=$t);redo}$s