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); BigInteger T = new BigInteger(sc.next()).subtract(BigInteger.ONE); BigInteger A = new BigInteger(sc.next()); BigInteger B = new BigInteger(sc.next()); 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)); } }