#include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
#include <map>
#include <string>
#include <algorithm>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <deque>
#include <functional>
#include <queue>
#include <cmath>
#include <array>
#include <queue>
#define int long long
using namespace std;
vector<int> arr(1000);
int p = 1'000'000'007;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, m, k;
cin >> n >> m;
int ans = 0, ans2 = 0;
int el = 0;
/*for (int i = 1; i <= m; i++) {
ans2 += n % i;
}*/
for (int i = 2; i <= min(m, n - 1); i++) {
int t = n % i;
k = n / i;
if (i + t / k <= min(m, n - 1)) {
int a = (t + t % k);
int b = (t / k + 1);
if (a % 2 == 0) {
a /= 2;
}
else {
b /= 2;
}
ans += (a % p) * (b % p);
i += t / k;
el++;
}
else {
int a = (t + (t - (min(m, n - 1) - i) * k));
int b = ((min(m, n - 1) - i) + 1);
if (a % 2 == 0) {
a /= 2;
}
else {
b /= 2;
}
ans += (a % p) * (b % p);
i += t / k;
el++;
}
ans %= p;
}
//cout << el << endl;
if (m >= n) {
ans += (n % p) * ((m - n) % p);
ans %= p;
}
cout << ans;
cin >> n;
return 0;
}
2144. Minimum Cost of Buying Candies With Discount | Non empty subsets |
1630A - And Matching | 1630B - Range and Partition |
1630C - Paint the Middle | 1630D - Flipping Range |
1328A - Divisibility Problem | 339A - Helpful Maths |
4A - Watermelon | 476A - Dreamoon and Stairs |
1409A - Yet Another Two Integers Problem | 977A - Wrong Subtraction |
263A - Beautiful Matrix | 180C - Letter |
151A - Soft Drinking | 1352A - Sum of Round Numbers |
281A - Word Capitalization | 1646A - Square Counting |
266A - Stones on the Table | 61A - Ultra-Fast Mathematician |
148A - Insomnia cure | 1650A - Deletions of Two Adjacent Letters |
1512A - Spy Detected | 282A - Bit++ |
69A - Young Physicist | 1651A - Playoff |
734A - Anton and Danik | 1300B - Assigning to Classes |
1647A - Madoka and Math Dad | 710A - King Moves |