Conditional Use of Sex and Parthenogenesis for Worker and Queen Production in Ants