Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll pk;
- ll sum(ll n){
- return (((n%mod)*((n+1ll)%mod))%mod * pk)%mod;
- }
- int main()
- {
- booster()
- //read("input.txt");
- ll n,m;
- pk = BigMod<ll>(2,mod-2);
- cin >> n >> m;ll tot = 0;
- ull x = n % mod;
- ull y = m % mod;
- ull ans = (x * y)%mod;
- ll mn = min(n,m);
- m = min(n,m);
- for(ll i = 1;i*i<=n;i++){
- ll le = n / i,ri = n / (i+1);
- le = min(le,m);
- if(ri>=le) continue;
- tot = ((tot + (i * ((sum(le) - sum(ri))%mod + mod )%mod )%mod))%mod;
- tot %= mod;
- mn = ri;
- }
- for(ll i = 1;i<=mn;i++) {
- tot = (tot + ((n/i)%mod * i)%mod)%mod;
- tot %= mod;
- }
- cout << (ans - tot + mod) % mod;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement