import math t, a, b = map(int, input().split()) t -= 1 bus1 = t // a bus2 = t // b bus12 = t // math.lcm(a, b) print(bus1 + bus2 - bus12 + 1)