#include using namespace std; int main(){ long long T, A, B; cin >> T >> A >> B; long long a, b, c, g; a = (T - 1)/A + 1; b = (T - 1)/B + 1; c = 1; g = __gcd(A, B); if (log(A) + log(B) - log(g) <= log(2e18)){ c = (T - 1) / (A / g * B) + 1; } cout << a + b - c << endl; return 0; }