式子好麻烦orz……大佬好腻害orz->
1 //minamoto 2 #include3 #include 4 #define ll long long 5 using namespace std; 6 const int N=1e7+5,mod=20101009; 7 int n,m,vis[N],p[N],cnt,mu[N];ll sum[N]; 8 ll ans,inv2,summ; 9 void init(int lim){10 mu[1]=1;11 for(int i=2;i<=lim;++i){12 if(!vis[i]) p[++cnt]=i,mu[i]=-1;13 for(int j=1;j<=cnt&&p[j]*i<=lim;++j){14 vis[i*p[j]]=1;15 if(i%p[j]==0) break;16 mu[i*p[j]]=-mu[i];17 }18 }19 for(int i=1;i<=lim;++i)20 (sum[i]=sum[i-1]+1ll*mu[i]*i*i)%=mod;21 }22 ll calc(int mx,int l){23 return (1ll+mx/l)*(mx/l)%mod*inv2%mod;24 }25 int main(){26 // freopen("testdata.in","r",stdin);27 scanf("%d%d",&n,&m);28 int lim;init(lim=min(n,m));29 ans=0,inv2=(mod+1)/2,summ=0;30 for(int d=1;d<=lim;++d){31 int mxx=n/d,myy=m/d,mn=min(mxx,myy);32 summ=0;33 for(int l=1,r;l<=mn;l=r+1){34 r=min(mxx/(mxx/l),myy/(myy/l));35 (summ+=(sum[r]-sum[l-1])%mod*calc(mxx,l)%mod*calc(myy,l)%mod)%=mod;36 }37 (ans+=summ*d)%=mod;38 }39 printf("%lld\n",(ans%mod+mod)%mod);40 return 0;41 }