#include <stdio.h>

int main(void){
	int i;
	int n,a,b,ab;
	int diff,ans;

	while(scanf("%d%d%d",&n,&a,&b) && (n||a||b)){
		ab = a+b;
		ans = n;
		for(i=n;i>0;i--){
			diff = i%ab;
			if(i%a==0 || i%b==0 || diff%a==0 || diff%b==0) ans--;
		}
		printf("%d\n",ans);
	}

	return 0;
}