#include<stdio.h>
int main(void)
{
    int n,a,b,c,count;
    int i,j;

    while(1)
    {
        count=0;
        scanf("%d %d %d",&n,&a,&b);

        if(n==0 && a==0 && b==0)
        {
            break;
        }

        if(b<a)
        {
            c=b;
            b=a;
            a=c;
        }

        if(b%a==0)
        {
            printf("%d\n",n-n/a);
            continue;
        }

        while(a%2==0 && b%2==0)
        {
            a/=2;
            b/=2;
            n/=2;
        }

        int num[(a-1)*b];

        for(i=0;i<(a-1)*b;i++)
        {
            num[i]=0;
        }

        i=0;
        while(1)
        {
            j=0;
            if(i*a>=(a-1)*b)
            {
                break;
            }
            while(1)
            {
                int x=i*a+j*b;
                if(x>=(a-1)*b)
                {
                    break;
                }
                num[x]=1;
                j++;
            }
            i++;
        }

        if(n<(a-1)*b)
        {
            for(i=1;i<=n;i++)
            {
                if(num[i]==1)
                {
                    count++;
                }
            }
            printf("%d\n",count);
        }
        else
        {
            for(i=1;i<(a-1)*b;i++)
            {
                if(num[i]==1)
                {
                    count++;
                }
            }
            printf("%d\n",count+n-(a-1)*b+1);
        }
    }
    return 0;
}