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 let mutable primes:int list = [] isPrime.[0] <- false isPrime.[1] <- false let ul1 = L/2 |> double |> sqrt |> int |> (+) 1 for i = 2 to ul1 do if isPrime.[i] = true then for j in [(i*i)..i..(L/2 + 99)] do isPrime.[j] <- false for i = 2 to (L/2 + 1) do if isPrime.[i] = true && LL >= ((NL-1L) * (int64 i)) then primes <- i :: primes primes <- primes |> List.rev let ans:int64 = primes |> List.sumBy (fun p -> (( L - ((N-1) * p) + 1 ) |> int64 ) ) printfn "%d" ans () let mySol = new Sol() mySol.Solve()