Using the above mentioned formula to find ans % MOD
ans += ( ( n // ( curStart * curStart ) % MOD * ( sumOfSquares ( end ) + MOD - sumOfSquares ( curStart - 1 ) ) ) % MOD ) NEW_LINE if ( ans >= MOD ) : NEW_LINE INDENT ans -= MOD NEW_LINE DEDENT