#include using namespace std; typedef long long ll; const ll N=3e6+9; const ll MOD=1e9+7; ll n,m,mu[N],p[N],cnt; bool vst[N]; ll f(ll n,ll d){ return (n*((n-1)/d)%MOD-(((n-1)/d)*((n-1)/d+1)/2)%MOD*d%MOD+MOD)%MOD; } int main(){ cin>>n>>m; if(n>m) swap(n,m); mu[1]=1; for(ll i=2;i<=n;i++){ if(!vst[i]){ p[++cnt]=i; mu[i]=-1; } for(ll j=1;j<=cnt&&p[j]*i<=n;j++){ vst[p[j]*i]=1,mu[p[j]*i]=-mu[i]; if(i%p[j]==0){mu[p[j]*i]=0;break;} } } ll ans=0; for(ll d=1;d