base = gets.split(' ').map {|i| i.to_i}
l = base[0]
r = base[1]

is_first = true
min = nil
array = []
l.upto(r) {|i| array << i}

array.combination(2) {|s, f|
  m = (s * f) % 2019
  #puts "#{s}, #{f}, #{m}"
  if m == 0
    puts 0
    exit
  end
  if min == nil
    min = m
  elsif m < min
    min = m
  end
}

puts min
