#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=100010;
LL f[N];
int main()
{
freopen("energy2010.in","r",stdin);
freopen("energy2010.out","w",stdout);
int n,m;cin>>n>>m;
int mn=min(n,m);
if(n>m) swap(n,m);
LL ans=0;
for(register int i=mn;i>=1;i--)
{
f[i]=(LL)(n/i)*(m/i);
for(int j=2;j*i<=mn;j++)
{
f[i]-=f[i*j];
}
ans+=(i*2-1)*f[i];
}
cout<<ans;
}