while 1:

    n,a,b=list(map(int,input().split()))

    if n==a==b==0:break

    c=0;d=[1]+[0]*2000000

    for i in range(0,n+1):

        if d[i]:d[i+a]=d[i+b]=1

        else:c+=1

    print(c)
while 1:

    n,a,b=list(map(int,input().split()))

    if n==a==b==0:break

    c=0;d=[1]*(n+1)

    for x in range(a):

        for i in range(x*b,n+1,a):d[i]=0

    print((sum(d)))
while 1:
    n, a, b = list(map(int, input().split()))
    if n == a == b == 0:
        break
    c = 0
    d = [1] + [0] * 2000000
    for i in range(0, n + 1):
        if d[i]:
            d[i + a] = d[i + b] = 1
        else:
            c += 1
    print(c)

while 1:
    n, a, b = list(map(int, input().split()))
    if n == a == b == 0:
        break
    c = 0
    d = [1] * (n + 1)
    for x in range(a):
        for i in range(x * b, n + 1, a):
            d[i] = 0
    print((sum(d)))

-    d = [1] + [0] * 2000000 -    for i in range(0, n + 1): -        if d[i]: -            d[i + a] = d[i + b] = 1 -        else: -            c += 1 -    print(c) +    d = [1] * (n + 1) +    for x in range(a): +        for i in range(x * b, n + 1, a): +            d[i] = 0 +    print((sum(d)))