open System

let S = stdin.ReadLine().Split() |> Array.map int
let i = S.[0]
let j = S.[1]

let ans = 
    let a = min j i+2019
    List.min [ for l in i..(a-1) ->
                List.min [ for r in (l+1)..a -> r * l ]
             ]
ans % 2019 |> stdout.WriteLine