Bidirectional Monte Carlo ray tracing with photon maps is a powerful method for rendering images. But stochastic noise is inherent in it. However, this noise can be reduced using the multiple importance sampling technique which combines the weighted results of different strategies. The optimal weights allow you to minimize the noise functional and, thus, render the image of the best quality. In this paper, we determine the optimal weights using a system of integral equations derived and solved by us. This system has several qualitative differences from the case of mixing two strategies investigated previously. But further increasing the number of strategies does not change the qualitative features of the system. The system can be solved in a closed form, i.e. as an algebraic formula that includes several integrals of known functions. They can be calculated during ray tracing. Therefore, application of the optimal weights in Monte Carlo ray tracing results in faster rendering of high quality realistic images.