#include using namespace std; #define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) typedef long long ll; ll gcm(ll a, ll b){ ll c; if(a < b){ c = a; a = b; b = c; } while(b){ c = a%b; a = b; b = c; } return a; } int main(void){ ll t, a, b; cin >> t >> a >> b; if(t/a == 0){ if(!(t%b)) cout << t/b << endl; else cout << t/b+1 << endl; return 0; } if(t/b == 0){ if(!(t%a)) cout << t/a << endl; else cout << t/a+1 << endl; return 0; } ll lcm = a/gcm(a, b)*b; ll ans = t/a+t/b-t/lcm+1; if(t%a == 0) ans--; if(t%b == 0) ans--; if(t%lcm == 0) ans++; cout << ans << endl; return 0; }