import math n, a, b = map(int,input().split()) k = math.gcd(a, b) print(n-n//a-n//b+n//(int(a*b/k)))