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