What did Moses his soldiers to do to the Midianites in Numbers 31?

To kill all the males and all the non-virgin females

(But keep the virgin females for themselves)
Kill every male among the little ones, and kill every woman that hath known man by lying with him.

But all the women children, that have not known a man by lying with him, keep alive for yourselves. Numbers 31:17-18