Magnification relations in gravitational lensing via multidimensional residue integrals