import math N,A,B=(int(x) for x in input().split()) print(N-N//A-N//B+N//(A*B//math.gcd(A,B)))