open System let input = Console.ReadLine().Split(' ') |> Array.map int64 let n = input.[0] let a = input.[1] let b = input.[2] // Count integers from 0 to N that are neither multiples of A nor multiples of B let multiples_of_a = n / a + 1L let multiples_of_b = n / b + 1L // LCM of A and B let rec gcd x y = if y = 0L then x else gcd y (x % y) let lcm x y = x * y / (gcd x y) let lcm_ab = lcm a b let multiples_of_both = n / lcm_ab + 1L // Using inclusion-exclusion principle let result = (n + 1L) - multiples_of_a - multiples_of_b + multiples_of_both printfn "%d" result