#include <iostream>
#include <queue>

using namespace std;

int main()
{
	for(int n,a,b;cin>>n>>a>>b,n|a|b;){
		vector<int> flg(n+1);
		queue<int> q;
		q.push(0);
		while(q.size()){
			int x=q.front(); q.pop();
			if(x>n || flg[x])
				continue;
			flg[x]=1;
			q.push(x+a);
			q.push(x+b);
		}
		int res=0;
		for(int i=1;i<=n;i++)
			res+=!flg[i];
		cout<<res<<endl;
	}
	
	return 0;
}