The Goldilocks contract: The synergistic benefits of combining structure and autonomy for persistence, creativity, and cooperation