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