#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
using namespace std;
const int MOD=998244353;
int n,m,cnt;
int gcd(int a,int b)
{
return a%b==0?b:gcd(b,a%b);
}
int main()
{
freopen("hoip.in","r",stdin);
freopen("hoip.out","w",stdout);
int a,b;
long long sum=0;
cin>>a>>b;
for(int i=1;i<=a;i++)
for(int j=1;j<=b;j++)
sum+=gcd(i,j),sum%=MOD;
cout<<sum%MOD<<'\n' ;
return 0;
}