if this remainder appeared before then the numbers are irrational and would not converge to a solution the digits after decimal will be infinite
if ( m . has ( x ) ) return - 1 ; m . set ( x , 1 ) ; x = x * 10 ; } return ans ; }