#include using namespace std; using ll = long long; #define ALL(v) v.begin(),v.end() #define dbg(x) cerr << #x << ": " << (x) << endl; template ostream& operator<<(ostream& os, pair& p) { os << '(' << p.first << ',' << p.second << ')'; return os; } template void print(Iter beg, Iter end) { for (Iter itr = beg; itr != end; ++itr) { cerr << *itr << ' '; } cerr << '\n'; } ll t,a,b; ll lcm(ll x, ll y) { return x / gcd(x,y) * y; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> t >> a >> b; --t; ll ans = t / a + 1; ans += t / b + 1; ans -= t / lcm(a,b) + 1; cout << ans << '\n'; }