import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); long t = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long count = (t - 1) / a + (t - 1) / b; count -= (t - 1) / a / (b /gcd(a, b)); System.out.println(count + 1); } static long gcd(long a, long b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } }