Extended Euclid to solve Diophantine Equation