open System let ri () = stdin.ReadLine() |> int let ria () = stdin.ReadLine().Split() |> Array.map int let rl () = stdin.ReadLine() |> int64 let rla () = stdin.ReadLine().Split() |> Array.map int64 type Sol() = member this.Solve() = let rec gcd a b = if a = 0L then b else gcd (b%a) a let lcm a b = a * b / (gcd a b) let N = rl () let [|a; b; c|] = rla () let mutable sum = N sum <- [a;b;c] |> Seq.sumBy (fun x -> N/x ) sum <- sum - ([(a,b);(b,c);(c,a)] |> Seq.sumBy (fun (x,y) -> N / (lcm x y) ) ) sum <- sum + (N / (Seq.reduce lcm [a;b;c])) sum |> printfn "%d" let mySol = new Sol() mySol.Solve()