#include<iostream> #include<cstdio> #define maxn 5000010 #define ll long long usingnamespacestd;
constint p = 1000000007;
ll pow_mod(ll x, ll n){ ll s = 1; for (; n; n >>= 1) { if (n & 1) s = s * x % p; x = x * x % p; } return s; }
int n, m, k;
int pri[maxn], cnt, a[maxn]; bool isp[maxn]; ll f[maxn]; voidinit_isp(int n){ for (int i = 2; i <= n; ++i) { if (!isp[i]) pri[++cnt] = i, a[i] = 1; for (int j = 1; j <= cnt && i * pri[j] <= n; ++j) { isp[i * pri[j]] = 1; if (i % pri[j] == 0) { a[i * pri[j]] = a[i]; break; } a[i * pri[j]] = i; } } f[1] = 1; for (int i = 1; i <= cnt; ++i) { ll pk = pow_mod(pri[i], k), inv = pow_mod(pk, p - 2); for (ll j = pri[i], t = pk; j <= n; j *= pri[i], t = t * pk % p) f[j] = t * (1 - inv) % p; } for (int i = 2; i <= n; ++i) if (a[i] > 1) f[i] = f[i / a[i]] * f[a[i]] % p; for (int i = 1; i <= n; ++i) f[i] = (f[i] + f[i - 1]) % p; }
voidwork(){ cin >> n >> m; ll ans = 0; if (n > m) swap(n, m); for (int l = 1, r; l <= n; l = r + 1) { r = min(n / (n / l), m / (m / l)); ans = (ans + (f[r] - f[l - 1]) * (n / l) % p * (m / l)) % p; } cout << (ans + p) % p << "\n"; }