An algorithm for the exact evaluation of the underground lightning electromagnetic fields