L, R = gets.split.map &:to_i
MOD = 2019

upper = R / MOD * MOD
if upper.between?(L, R)
  p 0
  exit
end

a, b =  [*L..R].map{|n| n % MOD }.combination(2).min_by{|a, b|
  a * b % MOD
}
# p [a, b]
p a * b % MOD