Let's TAKE , 7 9999 = x ( mod 1000 )
so , 7 10000 = 7 x ( mod 1000 )
But see , according to Euler's totient function theorem , 7 f ( p ) = 1 ( mod 1000 ) ,
Here , f ( p ) = 1000 ( 1 - 1 / 2 ) ( 1 - 1 / 5 ) = 400
So , 7 10000 = 1 ( mod 1000 )
Hence , 7 x = 1 ( mod 1000 ) ,
Clearly , x = 143 gives ,
7 x 143 = 1001 = 1 ( mod 1000 )