open System type Sol() = member this.Solve() = let [|N;L|] = stdin.ReadLine().Split() |> Array.map int let NL = int64 N let LL = int64 L let isPrime = Array.create (L/2 + 100) true isPrime.[0] <- false isPrime.[1] <- false for i = 2 to 1 + int ((sqrt (double (L/2 + 100)))) do if isPrime.[i] = true && LL >= ((NL-1L) * (int64 i)) then for j in [(i*i)..i..(L/2 + 99)] do isPrime.[j] <- false let primes = Seq.zip isPrime [0..(L/2 + 99)] |> Seq.filter (fun (b,p) -> b = true) |>Seq.map snd let ans:int64 = primes |> Seq.sumBy (fun p -> (( L - ((N-1) * p) + 1 ) |> int64 ) ) printfn "%d" ans () let mySol = new Sol() mySol.Solve()