extend gcd