import math MOD=1000000007 T, A, B = list(map(int, input().split())) print((T-1)//A + (T-1)//B - (T-1)//(A*B//math.gcd(A, B)) + 1);