Coevolution of sexual and male dimorphism