Solve GCD.