Problem – Chef And Number Game
The question asks the programmer to print the summation of factorials between a given range of numbers modular 10e9+7. The trick is to add 10e9+7 in the final expression (line 43) and then taking the modulo of the whole.
Update- The one thing that skipped was that in line 38, we might score a negative value. Which in turn suggests that we have to take modulo of a negative number which obviously won’t return the answer that we quite expect. So as to overcome that problem I added the “mod” macro back into the result so that it can return modulo of a positive value without affecting the answer.