The Extended Euclidean Algorithm