int n; int pri[maxn],pcnt,nop[maxn],mu[maxn]; int a,b,k;
void GetPrime() { mu[1]=1,nop[1]=1; for(register int i=2;i<=N;++i) { if(!nop[i])pri[++pcnt]=i,mu[i]=-1; for(register int j=1;j<=pcnt && i*pri[j]<=N;++j) { nop[i*pri[j]]=1; if(i%pri[j]==0)break; else mu[i*pri[j]]=-mu[i]; } } for(register int i=1;i<=N;++i)mu[i]+=mu[i-1]; }
int Calc() { int re=0,up=min(a,b)/k; for(register int l=1,r;l<=up;l=r+1) { r=min(a/(a/l),b/(b/l)); re+=(mu[r]-mu[l-1])*(a/(l*k))*(b/(l*k)); } return re; }