Outsourced extendedEuclideanAlgorithm