Some researchers have few main ideas that they apply to many different problems -- they are called hedgehogs. Other researchers have many ideas but apply them to fewer problems -- they are called foxes. Both approaches have their advantages and disadvantages. What is the best balance between these two approaches? In this paper, we provide general recommendations about this balance. Specifically, we conclude that the optimal productivity is when the time spent on generating new ideas is equal to the time spent on understanding new applications. So, if for a researcher, understanding a new problem is much easier than generating a new idea, this researcher should generate fewer ideas -- i.e., be a hedgehog. Vice versa, if for a researcher, generating a new idea is easier than understanding a new problem, it is more productive for this person to generate many ideas -- i.e., to be a fox. For researchers for whom these times are of the same order, we provide explicit formulas for the optimal research strategy.