solve gcd