Explicit versus implicit contracts for dividing the benefits of cooperation