#include<bits/stdc++.h>
using namespace std;
const long long INF=1e18;
const int MX=1e5+42;
bool prime[MX];
int mu[MX];
void init()
{
prime[1]=1;
for(int i=2;i*i<MX;i++)
if(prime[i]==0)
{
for(int j=i*i;j<MX;j=j+i) prime[j]=1;
}
for(int i=1;i<MX;i++) mu[i]=1;
for(int p=1;p<MX;p++)
if(prime[p]==0)
{
for(int i=p;i<MX;i=i+p) mu[i]=-mu[i];
if(1LL*p*p<MX)
{
for(int j=p*p;j<MX;j=j+p*p) mu[j]=0;
}
}
}
long long n,x,y;
const int BITS=16,SUB=(1<<BITS)-1;
long long eval(long long x_,long long y_)
{
long long y1=y_>>BITS;
long long y2=y_&SUB;
pair<long long,long long> ret={x_*y1/(x_+y_),x_*y1%(x_+y_)};
ret.first=ret.first<<BITS;
ret.second=ret.second<<BITS;
ret.second+=x_*y2;
ret.first+=ret.second/(x_+y_);
return ret.first;
}
vector<long long> compressed(long long n_,long long x_,long long y_)
{
n_=min(n_,eval(x_,y_));
return {n_,x_,y_};
}
long long go_n(long long n_,long long b1,long long from,long long to)
{
n_=n_/b1;
to=min(to,n_);
long long ret=0;
while(from<=to)
{
long long cur=n_/from;
long long to_cur=min(n_/cur,to);
ret+=cur*(to_cur-from+1);
from=to_cur+1;
}
return ret;
}
long long go_y(long long y_,long long b1,long long to)
{
return go_n(y_,b1,b1+1,b1+to);
}
long long go_x(long long x_,long long b1,long long from)
{
long long ret=0;
while(1)
{
long long c=x_/from/(from+b1);
if(c==0)break;
long long to=(-b1+sqrt(1LL*b1*b1+4*x_/c))/2;
ret+=(to-from+1)*c;
from=to+1;
}
return ret;
}
long long h_fast(long long n_,long long x_,long long y_)
{
vector<long long> given=compressed(n_,x_,y_);
n_=given[0];
x_=given[1];
y_=given[2];
if(n_<=0)return 0;
long long ret=0;
for(long long b1=1;b1*b1<=y_;b1++)
{
long long to_y=(1LL*n_*b1-1)/(y_-n_);
long long from_x=(1LL*(x_-n_)*b1+n_)/n_;
ret+=go_y(y_,b1,to_y);
ret+=go_x(x_,b1,from_x);
ret+=go_n(n_,b1,to_y+1,from_x-1);
}
return ret;
}
long long fast_opt()
{
long long res=0;
for(long long i=1;i*i<=n;i++)
{
vector<long long> given=compressed(n/i/i,x/i/i,y/i/i);
if(given[0]==0)break;
long long coeff=0,j=i;
while(compressed(n/j/j,x/j/j,y/j/j)==given)
{
coeff+=mu[j];
j++;
}
j--;
i=j;
if(coeff==0)continue;
long long cur=h_fast(n/i/i,x/i/i,y/i/i);
res+=coeff*cur;
}
return res;
}
int main()
{
init();
cin >> n >> x >> y;
if(x>y)swap(x,y);
long long res=fast_opt();
cout << res;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgbG9uZyBsb25nIElORj0xZTE4Owpjb25zdCBpbnQgTVg9MWU1KzQyOwpib29sIHByaW1lW01YXTsKaW50IG11W01YXTsKdm9pZCBpbml0KCkKewogICAgcHJpbWVbMV09MTsKICAgIGZvcihpbnQgaT0yO2kqaTxNWDtpKyspCiAgICAgICAgaWYocHJpbWVbaV09PTApCiAgICAgICAgewogICAgICAgICAgICBmb3IoaW50IGo9aSppO2o8TVg7aj1qK2kpIHByaW1lW2pdPTE7CiAgICAgICAgfQogICAgZm9yKGludCBpPTE7aTxNWDtpKyspIG11W2ldPTE7CiAgICBmb3IoaW50IHA9MTtwPE1YO3ArKykKICAgICAgICBpZihwcmltZVtwXT09MCkKICAgICAgICB7CiAgICAgICAgICAgIGZvcihpbnQgaT1wO2k8TVg7aT1pK3ApIG11W2ldPS1tdVtpXTsKICAgICAgICAgICAgaWYoMUxMKnAqcDxNWCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZm9yKGludCBqPXAqcDtqPE1YO2o9aitwKnApIG11W2pdPTA7CiAgICAgICAgICAgIH0KICAgICAgICB9Cn0KbG9uZyBsb25nIG4seCx5Owpjb25zdCBpbnQgQklUUz0xNixTVUI9KDE8PEJJVFMpLTE7C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bG9uZyBsb25nIGdvX3gobG9uZyBsb25nIHhfLGxvbmcgbG9uZyBiMSxsb25nIGxvbmcgZnJvbSkKewogICAgbG9uZyBsb25nIHJldD0wOwogICAgd2hpbGUoMSkKICAgIHsKICAgICAgICBsb25nIGxvbmcgYz14Xy9mcm9tLyhmcm9tK2IxKTsKICAgICAgICBpZihjPT0wKWJyZWFrOwogICAgICAgIGxvbmcgbG9uZyB0bz0oLWIxK3NxcnQoMUxMKmIxKmIxKzQqeF8vYykpLzI7CiAgICAgICAgcmV0Kz0odG8tZnJvbSsxKSpjOwogICAgICAgIGZyb209dG8rMTsKICAgIH0KICAgIHJldHVybiByZXQ7Cn0KbG9uZyBsb25nIGhfZmFzdChsb25nIGxvbmcgbl8sbG9uZyBsb25nIHhfLGxvbmcgbG9uZyB5XykKewogICAgdmVjdG9yPGxvbmcgbG9uZz4gZ2l2ZW49Y29tcHJlc3NlZChuXyx4Xyx5Xyk7CiAgICBuXz1naXZlblswXTsKICAgIHhfPWdpdmVuWzFdOwogICAgeV89Z2l2ZW5bMl07CiAgICBpZihuXzw9MClyZXR1cm4gMDsKICAgIGxvbmcgbG9uZyByZXQ9MDsKICAgIGZvcihsb25nIGxvbmcgYjE9MTtiMSpiMTw9eV87YjErKykKICAgIHsKICAgICAgICBsb25nIGxvbmcgdG9feT0oMUxMKm5fKmIxLTEpLyh5Xy1uXyk7CiAgICAgICAgbG9uZyBsb25nIGZyb21feD0oMUxMKih4Xy1uXykqYjErbl8pL25fOwogICAgICAgIHJldCs9Z29feSh5XyxiMSx0b195KTsKICAgICAgICByZXQrPWdvX3goeF8sYjEsZnJvbV94KTsKICAgICAgICByZXQrPWdvX24obl8sYjEsdG9feSsxLGZyb21feC0xKTsKICAgIH0KICAgIHJldHVybiByZXQ7Cn0KbG9uZyBsb25nIGZhc3Rfb3B0KCkKewogICAgbG9uZyBsb25nIHJlcz0wOwogICAgZm9yKGxvbmcgbG9uZyBpPTE7aSppPD1uO2krKykKICAgIHsKICAgICAgICB2ZWN0b3I8bG9uZyBsb25nPiBnaXZlbj1jb21wcmVzc2VkKG4vaS9pLHgvaS9pLHkvaS9pKTsKICAgICAgICBpZihnaXZlblswXT09MClicmVhazsKICAgICAgICBsb25nIGxvbmcgY29lZmY9MCxqPWk7CiAgICAgICAgd2hpbGUoY29tcHJlc3NlZChuL2ovaix4L2ovaix5L2ovaik9PWdpdmVuKQogICAgICAgIHsKICAgICAgICAgICAgY29lZmYrPW11W2pdOwogICAgICAgICAgICBqKys7CiAgICAgICAgfQogICAgICAgIGotLTsKICAgICAgICBpPWo7CiAgICAgICAgaWYoY29lZmY9PTApY29udGludWU7CiAgICAgICAgbG9uZyBsb25nIGN1cj1oX2Zhc3Qobi9pL2kseC9pL2kseS9pL2kpOwogICAgICAgIHJlcys9Y29lZmYqY3VyOwogICAgfQogICAgcmV0dXJuIHJlczsKfQppbnQgbWFpbigpCnsKICAgIGluaXQoKTsKICAgIGNpbiA+PiBuID4+IHggPj4geTsKICAgIGlmKHg+eSlzd2FwKHgseSk7CiAgICBsb25nIGxvbmcgcmVzPWZhc3Rfb3B0KCk7CiAgICBjb3V0IDw8IHJlczsKICAgIHJldHVybiAwOwp9Cg==