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 let rec gcd (a:int64) (b:int64) :int64 = if a = 0L then b else gcd (b%a) a let lcm (a:int64) (b:int64) :int64 = 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"