Add extended euclidean algorithm