from fractions import gcd T, A, B = map(int, input().split()) T-=1 ans = 1 + T//A + T//B - T // (A*B //gcd(A, B)) print(ans)