After searching online for 40G QSFP+ SR4/ESR4 optics, I agree with you that ESR4 optics are much more expensive than SR4. Maybe you can choose JNP-QSFP-40G-LX4,(150m over OM4 MMF, 2km over SMF). This 40G QSFP+LX4 optics can
can be used with both MMF and SMF without the need for any changes to the transceiver module. Seems more suitable for you.