N,A,B = map(int, input().split()) import math tmp = A * B // math.gcd(A,B) print(N-N//A-N//B+N//tmp)