import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } public void run() { Scanner sc = new Scanner(System.in); long t = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); if (!(1 <= t && 1 <= a && 1 <= b && t <= 1e18 && a <= 1e18 && b <= 1e18)) throw new AssertionError(); BigInteger T = BigInteger.valueOf(t).subtract(BigInteger.ONE); BigInteger A = BigInteger.valueOf(a); BigInteger B = BigInteger.valueOf(b); BigInteger ans = BigInteger.ZERO; ans = ans.add(T.divide(A)); ans = ans.add(T.divide(B)); ans = ans.subtract(T.divide(A.multiply(B).divide(A.gcd(B)))); ans = ans.add(BigInteger.ONE); System.out.println(ans); } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }