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 . find ( x ) != m . end ( ) ) return -1 ; m [ x ] = 1 ; x = x * 10 ; } return ans ; }