#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(int a, int b) { return a / gcd(a, b) * b; } int main() { ll t, a, b; cin >> t >> a >> b; t--; ll ans = t / a + t / b - t / lcm(a, b) + 1; cout << ans << endl; }