fixed euclidian method for input method