#include using namespace std; using ll = long long int; ll gcd(ll a, ll b){ while(b != 0){ ll r = a%b; a = b; b = r; } return a; } int main(){ ll t, a, b; cin >> t >> a >> b; ll ans = (t+a-1)/a + (t+b-1)/b; ll g = gcd(a, b); if(b/g <= 1'000'000'000'000'000'000/a){ ll l = a*(b/g); ans -= (t+l-1)/l; }else{ ans--; } cout << ans << endl; return 0; }