In algebraic geometry, there is a reduction algorithm that transforms the unreduced divisor into a unique reduced divisor, which existence is guaranteed by the Riemann-Roch theorem. We discuss application of this algorithm to construction of finite-dimensional superintegrable systems with n degrees of freedom identifying coordinates of the reduced divisor with integrals of motion.