Extended Euclid algorithm