Returns modulo inverse of a with respect to m using extended Euclid Algorithm
long long modInverse ( long long a , long long m ) { long long m0 = m , t , q ; long long x0 = 0 , x1 = 1 ; if ( m == 1 ) return 0 ; while ( a > 1 ) {