Correction of extended_gcd..This version works properly