l, r = gets.chomp.split(' ').map{|v| v.to_i}

min = 2018
(l...r).each {|i|
    break if min == 0
    ((i+1)..r).each {|j|
        min = (i * j)%2019 if min > (i*j)%2019
        break if min == 0
    }
}

puts min