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 s t = if s = 0L then t else gcd (t%s) s let lcm s t = s * t / (gcd s t) 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()