l,r = gets.split.map(&:to_i)

mod = 2019

w = l/mod
l %= mod
r -= mod*w

min = 2020

if r>=mod
  p 0
elsif 
  for i in l..r
    for j in i+1..r
      a = i*j%mod
      min = a if min > a
    end
  end
  p min
end
