Implemented modular inverse