#include <stdio.h>
#include <string.h>

int main(void){
	int i;
	int n,a,b,ab;
	int remAB,remA,remB,ans;

	while(scanf("%d%d%d",&n,&a,&b) && (n||a||b)){
		ab = a+b;
		ans = n;
		for(i=n;i>0;i--){
			remAB = i % ab;
			remA = i % a;
			remB = i % b;

			if(i%a==0 || i%b==0 || remAB%a==0 || remAB%b==0 ||
				 remA%b==0 || remA%ab==0 || remB%a==0 || remB%ab==0){
				ans--;
			}
		}
		printf("%d\n",ans);
	}

	return 0;
}