#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long n,m;
long long ans;
const int mod=998244353;
long long gcd(long long x,long long y){
if(y==0)return x;
return gcd(y,x%y);
}
int main(){
freopen("hoip.in","r",stdin);
freopen("hoip.out","w",stdout);
cin>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
ans=ans%mod+gcd(i,j)%mod;
cout<<ans%mod<<endl;
return 0;
}