Added implementation of the extended GCD algorithm.