output modulo 10^9+7

i am newbie to codechef problems…can please anyone explain how to write the code in c or C++14 to show output modulo 10^9+7 …as asked in problems…plz help…if u can show a code problem for it …it would of great help…i know coding but i just only want to know how to show output in the given format…

if your output is ans you just print ans%1000000007. Make sure you modulo ‘ans’ for every ‘+’, ‘-’, ‘*’ operation.

Hey newbie,

The easiest way is defining it as global variable as

long long mod = 1000000007;

or

#define mod 1000000007

or

#define mod 1e9+7

then using it in the main or other functions as asked, using some modulo properties

Hope this helps!

if you could provide a code of a problem as an example for…it would be wonderful

i need a code for example…

if you can refer to a question involving it in practice problem