Public Class Compiler
    Shared Sub Main()
        Const c As Integer = 2019
        Dim input As String() = Console.ReadLine().Split(" ")
        Dim l As Integer = Integer.Parse(input(0)) Mod c
        Dim r As Integer = Integer.Parse(input(1)) Mod c
        Dim output As Integer = 2017 * 2018
        Dim k As Integer = l
        While k <> r
            Dim tmp As Integer = (k + 1) Mod c
            If output > k * tmp Then output = k * tmp
            k = tmp
        End While
        Console.WriteLine(output)
    End Sub
End Class