Recursive implementation of Extended Euclid's algorithm