euclidean algorithm solver