#include using namespace std; typedef long long ll; ll gcd(ll a,ll b){ if(b==0){ return a; } return gcd(b,a%b); } int main(){ ll t,a,b;cin >> t >> a >> b; if(t==1){ if(a==1||b==1){ cout << 2 << endl; } else{ cout << 1 << endl; } return 0; } t--; ll c=a/gcd(a,b)*b; cout << t/a+t/b-t/c+1 << endl; }