multiplicative inverse & gcd