Extended greates common divisor