#include<iostream>
#include<cstdio>
#define MOD 998244353
using namespace std;
long long a,b;
long long ans;
long long gcd(long long x,long long y)
{
long long r=x%y;
while(x%y)
{
x=y;
y=r;
r=x%y;
}
return y;
}
int main()
{
freopen("hoip.in","r",stdin);
freopen("hoip.out","w",stdout);
scanf("%lld%lld",&a,&b);
for(register int i=1;i<=a;i++)
for(register int j=1;j<=b;j++) ans=(ans+gcd(i,j)%MOD)%MOD;
printf("%lld\n",ans);
return 0;
}