Wrote Extended Euclidean Algorithm Function