#include using namespace std; using ll = long long; using Pll = pair; using Pii = pair; constexpr ll MOD = 1000000007; constexpr long double EPS = 1e-10; constexpr int dyx[4][2] = { { 0, 1}, {-1, 0}, {0,-1}, {1, 0} }; ll gcd(ll a, ll b){ if(b == 0) return a; else return gcd(b, a%b); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll t, a, b; cin >> t >> a >> b; ll ans = ((t-1)/a+1) + ((t-1)/b+1); if(a/gcd(a, b) >= (ll(1e18)+b-1)/b) { --ans; } else { ans -= (t-1)/lcm(a, b) + 1; } cout << ans << endl; }