A general approach for improving RNS Montgomery exponentiation using pre-processing