We study the effect of the cubic torus topology of the Universe on scalar cosmological perturbations which define the gravitational potential. We obtain three alternative forms of the solution for both the gravitational potential produced by point-like masses, and the corresponding force. The first solution includes the expansion of delta-functions into Fourier series, exploiting periodic boundary conditions. The second one is composed of summed solutions of the Helmholtz equation for the original mass and its images. Each of these summed solutions is the Yukawa potential. In the third formula, we express the Yukawa potentials via Ewald sums. We show that for the present Universe, both the bare summation of Yukawa potentials and the Yukawa-Ewald sums require smaller numbers of terms to yield the numerical values of the potential and the force up to desired accuracy. Nevertheless, the Yukawa formula is yet preferable owing to its much simpler structure.