def _iexp(x, M, L=8):
 R = _nbits(((long(x) << L) // M))
 T = (- int((((-10) * len(str(M))) // (3 * L))))
 y = _div_nearest(x, T)
 Mshift = (long(M) << R)
 for i in xrange((T - 1), 0, (-1)):
  y = _div_nearest((x * (Mshift + y)), (Mshift * i))
 for k in xrange((R - 1), (-1), (-1)):
  Mshift = (long(M) << (k + 2))
  y = _div_nearest((y * (y + Mshift)), Mshift)
 return (M + y)

def _iexp ( x , M , L = 8 ) : R = _nbits ( ( ( long ( x ) << L ) // M ) ) T = ( - int ( ( ( ( - 10 ) * len ( str ( M ) ) ) // ( 3 * L ) ) ) ) y = _div_nearest ( x , T ) Mshift = ( long ( M ) << R ) for i in xrange ( ( T - 1 ) , 0 , ( - 1 ) ) : y = _div_nearest ( ( x * ( Mshift + y ) ) , ( Mshift * i ) ) for k in xrange ( ( R - 1 ) , ( - 1 ) , ( - 1 ) ) : Mshift = ( long ( M ) << ( k + 2 ) ) y = _div_nearest ( ( y * ( y + Mshift ) ) , Mshift ) return ( M + y )
given integers x and m .