text: How to avoid overflow in modular multiplication ? | A Simple solution that causes overflow when value of ( a % mod ) * ( b % mod ) becomes more than maximum value of long long int
code: #define ll  long long NEW_LINE ll multiply ( ll a , ll b , ll mod ) { return ( ( a % mod ) * ( b % mod ) ) % mod ; }