显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int mod=998244353;
long long n,m,prime[10000010],phi[10000010],cnt;
long long sum;
void eula(long long x){
phi[1]=1;
for(int i=2;i<=x;i++){
if(!phi[i]){prime[++cnt]=i;phi[i]=i-1;phi[i]%=mod;}
for(int j=1;j<=cnt;j++){
if(prime[j]*i>n)break;
if(i%prime[j]==0)phi[i*prime[j]]=(prime[j]%mod)*(phi[i]%mod);
else phi[i*prime[j]]=((prime[j]-1)%mod)*(phi[i]%mod);
}
}
}
int main(){
freopen("hoip.in","r",stdin);
freopen("hoip.out","w",stdout);
int qwq;
scanf("%d%d",&n,&m);
qwq=min(n,m);
eula(qwq);
for(int i=1;i<=qwq;i++)sum+=((phi[i]%mod)*((n/i)%mod)*((m/i)%mod)),sum%=mod;
printf("%lld",sum);
return 0;
}