import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigInteger; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); BigInteger t = new BigInteger(sa[0]).subtract(BigInteger.ONE); BigInteger a = new BigInteger(sa[1]); BigInteger b = new BigInteger(sa[2]); br.close(); BigInteger x = t.divide(a).add(BigInteger.ONE); BigInteger y = t.divide(b).add(BigInteger.ONE); BigInteger z = a.multiply(b).divide(a.gcd(b)); BigInteger w = t.divide(z).add(BigInteger.ONE); System.out.println(x.add(y).subtract(w).toString()); } }