The multiquark confining potential is proportional to the total distance of the fundamental strings linking the quarks and antiquarks. We address the computation of the total string distance an of the Fermat points where the different strings meet. For a meson (quark-antiquark system) the distance is trivially the quark-antiquark distance. For a baryon (three quark system) the problem was solved geometrically from the onset, by Fermat and by Torricelli. The geometrical solution can be determined just with a rule and a compass, but translation of the geometrical solution to an analytical expression is not as trivial. For tetraquarks, pentaquarks, hexaquarks, etc, the geometrical solution is much more complicated. Here we provide an iterative method, converging fast to the correct Fermat points and the total distances, relevant for the multiquark potentials. We also review briefly the geometrical methods leading to the Fermat points and to the total distances.