added modular exponential function