# https://atcoder.jp/contests/abc133/tasks/abc133_c

MOD = 2019

L, R = gets.split.map(&:to_i)

if L / MOD != R / MOD
  puts 0
else
  if (L - 1) / 3 != R / 3 && (L - 1) / 673 != R / 673
    puts 0
  else
    puts L * (L + 1) % MOD
  end
end
