Check out example codes for "how to modulo 10^9+7". It will help you in understanding the concepts better.

Code Example 1

In most of the programming competitions, 
we are required to answer the result in 10^9+7 modulo. 
The reason behind this is, 
if problem constraints are large integers, 
only efficient algorithms can solve them in allowed limited time.

use :
const unsigned int M = 1000000007;

Learn ReactJs, React Native from