import java.util.*; import java.io.*; public class Main { public static void main (String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 3); long t = Long.parseLong(first[0]) - 1; long a = Long.parseLong(first[1]); long b = Long.parseLong(first[2]); long ans = t / a + t / b - t / getLCM(a, b) + 1; System.out.println(ans); } static long getLCM(long a, long b) { long gcd = getGCD(a, b); long ans = a / gcd; if (Long.MAX_VALUE / b <= ans) { return Long.MAX_VALUE; } else { return ans * b; } } static long getGCD(long a, long b) { if (a % b == 0) { return b; } else { return getGCD(b, a % b); } } }