Optimal Contract for Experimentation and Production