while 1:

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

	if n == 0: break

	dp = [0]*(n+max(a,b)+1)

	dp[a] = dp[b] = 1

	for i in range(n+1):

		if dp[i]:

			dp[i+a] = dp[i+b] = 1

	print(n - sum(dp[:n+1]))
while 1:

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

	if n == 0: break

	S = [1]*(n+1)

	for i in range(a):

		s = b*i

		while s <= n:

			S[s] = 0

			s += a

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

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

-    dp = [0] * (n + max(a, b) + 1) -    dp[a] = dp[b] = 1 -    for i in range(n + 1): -        if dp[i]: -            dp[i + a] = dp[i + b] = 1 -    print(n - sum(dp[: n + 1])) +    S = [1] * (n + 1) +    for i in range(a): +        s = b * i +        while s <= n: +            S[s] = 0 +            s += a +    print(sum(S))