Implement Montgomory Reduction