module Yuki open System let rec gcd a b = if a < b then gcd b a elif b = 0L then a else gcd b (a % b) let lcm a b = a * (b / (gcd a b)) let solve N a b c = let cA = N / a let cB = N / b let cC = N / c let cAB = N / (lcm a b) let cBC = N / (lcm b c) let cCA = N / (lcm c a) let cABC = N / (lcm a (lcm b c)) cA + cB + cC - (cAB + cBC + cCA) + cABC let N = Console.ReadLine() |> int64 let a, b, c = let t = Console.ReadLine().Split() |> Array.map int64 t.[0], t.[1], t.[2] solve N a b c |> Console.WriteLine