Problem:
 Score : 300 points    Problem Statement You are given two non-negative integers L and R .
We will choose two integers i and j such that L \leq i < j \leq R .
Find the minimum possible value of (i \times j) \mbox{ mod } 2019 .      Constraints  All values in input are integers.  0 \leq L < R \leq 2 \times 10^9         Input Input is given from Standard Input in the following format:  L  R       Output Print the minimum possible value of (i \times j) \mbox{ mod } 2019 when i and j are chosen under the given condition.        Sample Input 1 2020 2040      Sample Output 1 2  When (i, j) = (2020, 2021) , (i \times j) \mbox{ mod } 2019  = 2 .       Sample Input 2 4 5      Sample Output 2 20  We have only one choice: (i, j) = (4, 5) .

Solution (Python):
l,r=map(int,input().split())
amari = 2018
if r-l > 2019:
  print(0)
else:
  for i in range(l, r+1):
    for j in range(i+1, r+1):
      temp = (i*j)%2019
      if temp < amari:
        amari = temp
     
  print(amari)

Solution (Python):
L,R = map(int,input().split())
if R-L >= 2018:
    print(0)
else:
    s = 2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            s = min(s, (i*j) % 2019)
    print(s)

Solution (Python):
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = il()
    ret = 2019
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            ret = min(ret, (i * j) % 2019)
            if ret == 0:
                break
        else:
            continue
        break

    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

mod = 2019
l, r = map(int, input().split())
if r-l >= mod:
  print(0)
  sys.exit()
  
l %= mod
r %= mod
if l >= r:
  print(0)
  sys.exit()
  
ans = mod
for i in range(l, r):
  for j in range(i+1, r+1):
    ans = min(ans, i * j % mod)
    
print(ans)

Solution (Python):
L, R = map(int, input().split())
mod = 2019
ans = 2018
for i in range(L, R):
    for j in range(i+1, R+1):
        if ans >= i*j%mod:
            ans = i*j%mod
        if ans == 0:
            break

    if ans == 0:
        break

print(ans)

Solution (Python):
L,R = map(int, input().split())
ans = 2018

s = list(map(int, range(L, min(L+2019, R+1))))
if 2019 in s:
    print(0)
    exit()

for i in s:
    for j in s[s.index(i)+1:]:
        ans = min(ans, i*j%2019)

print(ans)

Solution (Python):
MOD = 2019
l, r = map(int, input().split())
if r - l > MOD:
    print(0)
else:
    mods = sorted([item % MOD for item in range(l, r+1)])
    n = len(mods)
    ans = MOD
    for i in range(n):
        for j in range(i+1, n):
            if mods[i] * mods[j] % MOD < ans:
                ans = mods[i] * mods[j] % MOD
    print(ans)

Solution (Python):
l,r=map(int,input().split())
MOD= 2019 
if r-l>=2018:
    print(0)
    exit()
else:
    ltemp=l%MOD
    rtemp=r-l+ltemp
    ans=2019 
    for i in range(ltemp,rtemp):
        for j in range(i+1,rtemp+1):
            ans=min(ans,i*j%MOD)
    print(ans)

Solution (Python):
l, r = [int(x) for x in input().split()]

if r - l >= 2019:
    a = 0
    b = 2019
else:
    a = l % 2019
    temp = r % 2019
    b = temp if a < temp else temp + 2019

ans = 2019
for i in range(a, b):
    for j in range(i + 1, b + 1):
        temp = (i * j) % 2019
        if temp < ans:
            ans = temp
            if ans == 0:
                print(0)
                exit()
print(ans)

Solution (Python):
l, r = [int(x) for x in input().split()]

if r - l >= 2019:
    skip_flag = [False] * 2019
else:
    a = l % 2019
    temp = r % 2019
    b = temp if temp > a else temp + 2019
    skip_flag = [True] * 2019
    for i in range(a, b + 1):
        skip_flag[i % 2019] = False

if not skip_flag[0]:
    print(0)
    exit()

ans = 2019
for i in range(1, 2019):
    if skip_flag[i]:
        continue
    for j in range(i + 1, 2019):
        if skip_flag[j]:
            continue
        
        temp = (i * j) % 2019
        if temp < ans:
            ans = temp
print(ans)

Solution (Python):
import numpy as np
L,R = (int(x) for x in input().split())

if R - L > 3000:
  print(0)
  exit()
  
x = np.arange(L,R+1,dtype=np.int64)
y = x[:,None] * x[None,:] % 2019
for i in range(len(x)):
  y[i,i] = 3000
answer = y.min()
print(answer)

Solution (Python):
l, r = (int(_) for _ in input().split())
r = min(r,l+2019)
x = [i*ii%2019 for i in range(l,r+1) for ii in range(i+1,r+1)]
print(min(x))

Solution (Python):
l,r=map(int,input().split())
if r//2019-(l-1)//2019>0:
    print(0)
else:
    m=20000
    for i in range(l,r):
        for j in range(i+1,r+1):
            if m>(i*j)%2019:
                m=(i*j)%2019
    print(m)

Solution (Python):
l,r=map(int,input().split())
if r-l>2019:
    print(0)
else:
    l1=l%2019
    r1=r%2019
    k=(r1*l1)%2019
    for i in range(l1,r1):
        for j in range(i+1,r1+1):
            if i*j%2019<k:
                k=i*j%2019
    print(k)

Solution (Python):
l, r = map(int,input().split())

ans = 2019
flag = False
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
        
        if ans == 0:
            flag = True
            break
    if flag:
        break
print(ans)

Solution (Python):
L,R = map(int, input().split())
if R-L > 2017:
    print(0)
    exit()
ans = 2018
for i in range(L, R+1):
    for j in range(i+1, R+1):
        ans = min(ans, i*j%2019)
print(ans)

Solution (Python):
L, R = map(int, input().split())
MOD = 2019
ans = L*R%MOD
for i in range(L, R):
    for j  in range(i+1, R+1):
        if ans > i*j%MOD:
            ans = i*j%MOD
        if ans == 0:
            break
    if ans == 0:
        break
print(ans)

Solution (Python):

l, r = map(int, input().split())

r = min(r, l+673)
ans = 2018

for i in range(l, r+1, 1):
  for j in range(i+1, r+1, 1):
    x = i*j%2019
    ans = min(ans, x)

print(ans)

Solution (Python):
import sys

l,r=map(int,input().split())

x=int(r/2019)

if l<=(2019*x) and (2019*x)<=r:
  print("0")
  sys.exit()

m=-1

for i in range(l,r):
  for j in range(i+1,r+1):

    a=(i*j)%2019
    if a==0:
      
      print(a)
      sys.exit()

    elif m==-1 or m>a:
      
      m=a

print(m)

Solution (Python):
l,r=map(int,input().split())
if r-l+1>=2019:
  print(0)
  exit()
else:
  l=l%2019
  r=r%2019
  
  if l>=r:
    print(0)
    exit()
ans=10000000
for i in range(l,r+1):
  for j in range(i+1,r+1):
    ans=min(ans,(i*j)%2019)
print(ans)

Solution (Python):
l,r=map(int,input().split())
if r-l+1>=2019:
  print(0)
  exit()
else:
  l=l%2019
  r=r%2019  
  if l>=r:
    print(0)
    exit()
    
ans=10000000
for i in range(l,r+1):
  for j in range(i+1,r+1):
    ans=min(ans,(i*j)%2019)
print(ans)

Solution (Python):
l,r=map(int,input().split())
if r-l+1>=2019:
  print(0)
  exit()
else:
  l=l%2019
  r=r%2019
  
  if l>=r:
    r+=2019
ans=10000000
for i in range(l,r+1):
  for j in range(i+1,r+1):
    ans=min(ans,(i*j)%2019)
print(ans)

Solution (Python):
l, r = map(int, input().split())
m = 2019
if r - l >= 673:
    print(0)
else:
    ans = 2018
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, (i*j)%m)
        if ans <= 2:
            break
    print(ans)

Solution (Python):
l, r = map(int, input().split())
m = 2019
if r - l >= 673:
    print(0)
else:
    ans = 2018
    l = l%m
    r = r%m
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, (i*j)%m)
    print(ans)

Solution (Python):

"""
Created on Wed Apr 22 00:26:09 2020

@author: Kanaru Sato
"""

l,r = list(map(int, input().split()))
mod = 2019

if l//mod != r//mod:
    ans = 0
else:
    ans = 10000
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            tmp = (i*j)%mod
            if tmp < ans:
                ans = tmp

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

L, R = map(int, input().split())
if (R - L) > 3000:
    print(0)
    exit()
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
    print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

L, R = map(int, input().split())
if (R - L) > 3000:
    print(0)
    exit()
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
    print(ans)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    n, a, b = LI()
    print(min(n * a, b))
    return


def B():
    n, d = LI()
    x = LIR(n)
    a = list(itertools.combinations(range(n), 2))
    ans = 0
    for a1,a2 in a:
        b = 0
        for bi in range(d):
            b += (x[a1][bi] - x[a2][bi])** 2
        if float.is_integer(math.sqrt(b)):
            ans += 1
    print(ans)
    return


def C():
    l, r = LI()
    ans = 2018
    if l // 2019 == r // 2019:
        for i in range(l, r + 1):
            for k in range(i+1, r + 1):
                ans = min(ans, (i * k) % 2019)
        print(ans)
    else:
        print(0)
    return


def D():
    n = II()
    a = LI()
    a = a + [a[0]]
    ans = [0] * n
    x = 0
    for i in range(1, n, 2):
        x = x + a[i + 1] - a[i]
    ans[1] = a[0] - x
    ans[0] = ans[1] + 2 * x
    for i in range(2, n):
        ans[i] = (a[i - 1] - ans[i - 1] // 2) * 2
    print(" ".join(map(str, ans)))

    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    C()

Solution (Python):
l, r = map(int, input().split())

MOD = 2019
r = min(r, l + MOD - 1)

res = MOD - 1
for i in range(l, r):
    for j in range(i + 1, r + 1):
        res = min(res, (i % MOD) * (j % MOD) % MOD)
print(res)

Solution (Python):
l,r = map(int,input().split())
if r-l>=2019:
    print(0)
    exit()
ans = 2019
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
print(ans)

Solution (Python):
l,r = map(int,input().split())
m = 2018
if r-l>=2019:
  print(0)
else:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      a = (i*j)%2019
      m = min(a,m)
  print(m)

Solution (Python):
l, r = list(map(int, input().split()))


ans = 2019
for i in range(l, r+1):
    for j in range(i+1, r+1):
        if (i*j) % 2019 == 0:
            print(0)
            exit()
        else:
            if (i*j) % 2019 < ans:
                ans = (i*j) % 2019

print(ans)

Solution (Python):
L,R=map(int,input().split())

if L%2019==0 or R%2019==0 or L//2019!=R//2019:
    print(0)
else:
    mn=L*R % 2019
    for i in range(L,R):
        for j in range(i+1,R+1):
            mn=min(mn,i*j % 2019)
    print(mn)

Solution (Python):
l,r = map(int,input().split())
if r-l>=2019:
    print(0)
    exit()
ans = 2019
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
print(ans)

Solution (Python):
L, R = map(int, input().split())
r = L + min(2019, R - L)
ans = 2019
for i in range(L, r):
    for j in range(i + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    L, R = map(int, sys.stdin.readline().rstrip().split())

    if (R // 2019) > (L // 2019):
        print(0)
        exit()

    L %= 2019
    R %= 2019
    ans = 2019
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min(ans, (i*j) % 2019)
    
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
L, R = map(int, input().split())

L_q = L // 2019
R_q = R // 2019
mod = 2018

if L_q + R_q == 0:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod = min(i * j % 2019, mod)

    print(mod)

else:
    if R_q - L_q > 1:
        print(0)

    else:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod = min(i * j % 2019, mod)

        print(mod)

Solution (Python):

import io
import math

nim, mike = map(int, input().split())
if mike // 3 > (nim - 1) // 3 and mike // 673 > (nim - 1) // 673:
    print(0)
else:
    print(min(i * j % 2019 for i in range(nim, mike + 1) for j in range(nim, i)))

Solution (Python):
import sys
l, r = map(int, input().split())
lmod673 = l % 673
dif = r - l

if lmod673 + dif >= 673:
  print(0)
  sys.exit()

min_val = 2018
for bigger in range(l, r+1):
  for smaller in range(l, bigger):
    min_val = min(min_val, bigger*smaller % 2019)
print(min_val)

Solution (Python):
L, R = map(int, input().split())
MOD = 2019
if R - L + 1 >= MOD:
    print(0)
else:
    l_mod = L % MOD
    r_mod = R % MOD
    if r_mod < l_mod:
        print(0)
    else:
        min = (l_mod * (l_mod + 1)) % MOD
        for i in range(l_mod, r_mod):
            for j in range(i + 1, r_mod + 1):
                if ((i * j) % MOD) < min:
                    min = (i * j) % MOD
        print(min)

Solution (Python):
l, r = map(int, input().split())
mi = 2019
if r - l > 2020:
  mi = 0
else:
  for i in range(l,r+1):
    for j in range(i+1, r+1):
      mod = i*j % 2019
      if mod < mi:
        mi = mod
print(mi)

Solution (Python):
l,r = map(int, input().split())
if (r-l >= 2018):
    print(0)
    exit()
a = []
for i in range(l,r+1):
    a.append(i%2019)
a.sort()
if (a[0]==0):
    print(0)
    exit()
b = []
for i in range (0,len(a)-1):
    for j in range (1,len(a)):
        b.append((a[i]*a[j])%2019)
print(min(b))

Solution (Python):
import sys
MOD = 2019

l, r = map(int, sys.stdin.readline().split())
r = min(r, l + MOD - 1)

def main():
    res = MOD - 1
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i % MOD) * (j % MOD) % MOD)
    print(res)

if __name__ ==  '__main__':
    main()

Solution (Python):
import sys
MOD = 2019

l, r = map(int, sys.stdin.readline().split())
r = min(r, l + MOD - 1)

def main():
    res = MOD - 1
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i % MOD) * (j % MOD) % MOD)
    print(res)

if __name__ ==  '__main__':
    main()

Solution (Python):
l,r=map(int,input().split())
if r-l>=2019:
  print(0)
  exit()
m0=l%2019
m1=r%2019
if m1<m0:
  print(0)
  exit()
else:
  ans=2019
  for i in range(m0,m1):
    for j in range(i+1,m1+1):
      ans=min(ans,i*j%2019)
  print(ans)

Solution (Python):

l,r = map(int,input().split())
tmp = []
if r*(r-1) < 2019:
    print(r*(r-1))
    
else:
    if r - l >= 2019 or l <= (r//2019) * 2019 <= r :
        print(0)       
    else:
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                m = (i*j) % 2019
                tmp.append(m)
        print(min(tmp))

Solution (Python):
s=range(*eval(input().replace(' ',',1+')))[:673];print(min(i*j%2019for i in s for j in s if i<j))

Solution (Python):










mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    
    
    l,r = readInts()
    if r-l > 3000:
        print(0)
    else:
        res = 2018
        for i in range(l,r):
            for j in range(i+1,r+1): 
                res = min(res,(i * j) % 2019)
        print(res)
if __name__ == '__main__':
  main()

Solution (Python):
L, R = map(int, input().split())

if R - L >= 2019:
    print(0)
    exit(0)

A = []
for i in range(L, R + 1):
    A.append(i % 2019)

ans = 10e9
for i in range(0, len(A)):
    for j in range(i + 1, len(A)):
        ans = min(ans, (A[i] * A[j]) % 2019)

print(ans)

Solution (Python):
l,r = map(int,input().split())
s = range(l,r+1)[:673]
print(min(i*j%2019 for i in s for j in s if i<j))

Solution (Python):
L, R = map(int, input().split())
if (L <= 673 <= R and R - L >= 3) or (R - L >= 673):
    print(0)
else:
    mods = []
    mods_append = mods.append
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            m = (i * j) % 2019
            mods_append(m)
            if m == 2:
                break

    print(min(mods))

Solution (Python):
L, R = map(int, input().split())
MOD = 2019
if R - L >= MOD:
  print(0)
  exit(0)
lst = [x % MOD for x in range(L, R+1)]
N = len(lst)
mi = 10e9
for i in range(N-1):
  for j in range(i+1, N):
    mi = min(mi, lst[i] * lst[j] % MOD)
print(mi)

Solution (Python):
l,r=map(int,input().split())
a=range(l,r+1)[:673]
print(min(i*j % 2019 for i in a for j in a if i<j))

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    l,r=map(int,input().split())
    ans=2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans=min(ans,i*j%2019)
            if ans==0:
                print(0)
                sys.exit()
    print(ans)
if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    l,r=map(int,input().split())
    ans=2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans=min(ans,i*j%2019)
            if ans==0:
                print(0)
                sys.exit()
    print(ans)
if __name__=='__main__':
    main()

Solution (Python):
l, r = map(int, input().split())

min = 2019

for i in range(l, r+1):
    for j in range(i+1, r+1):
        p = (i % 2019)*(j % 2019) % 2019
        if p < min:
            min = p

        if min == 0:
            print("0")
            exit()

print(min)

Solution (Python):
L, R = map(int, input().split())
ans = float('inf')
for i in range(L, min(L+2019, R)):
    for j in range(i+1, min(L+2019, R) + 1):
        ans = min(ans, (i*j) % 2019)
print(ans)

Solution (Python):
l, r = map(int, input().split())
mod = 2019
_min = mod
for i in range(l, min(l + mod, r)):
  i_mod = i % mod
  for j in range(i + 1, min(i + mod, r) + 1):
    _min = min(_min, j % mod * i_mod % mod)
print(_min)

Solution (Python):
L, R = map(int, input().split())
ans = float('inf')
for i in range(L, min(L+2019, R)):
    for j in range(i+1, min(L+2019, R) + 1):
        ans = min(ans, (i*j) % 2019)
print(ans)

Solution (Python):
L,R = map(int,input().split())

ans = 2019
for i in range(L,min(L+2019,R)):
  for j in range(i+1,min(L+2019,R+1)):
    ans = min(ans,(i*j)%2019)

print(ans)

Solution (Python):
l, r = map(int,input().split())
s = range(l, r+1)[:673]
print(min(i*j % 2019 for i in s for j in s if i<j))

Solution (Python):
import math
def main():
    l, r = map(int,input().split())
    if r - l >= 637:
        print(0)
        return
    l_mod = l % 2019
    r_mod = r % 2019
    ans = []
    if l_mod > r_mod :
        ans = [i for i in range(l_mod,2019)]
        ans.extend([i for i in range(r_mod+1)])
    else:
        ans = [i for i in range(l_mod,r_mod+1)]
    ans.sort()
    a = 2019
    for i in range(len(ans)):
        for j in range(i + 1, len(ans)):
            a = min(a,(ans[i] * ans[j]) % 2019)
    print(a)

if __name__ == '__main__':
    main()

Solution (Python):
L,R=map(int,input().split())
ans=0
if R-L<2019:
    ans=min([i*j%2019 for i in range(L,R) for j in range(i+1,R+1)])
print(ans)

Solution (Python):
L,R=map(int,input().split())
if R-L>2019:   print(0)
else:
    ans=[i*j%2019 for i in range(L,R) for j in range(L+1,R+1)]
    print(min(ans))

Solution (Python):
L, R = map(int,input().split())
l = L % 2019
r = R % 2019
A = []
if R//2019 - L//2019 >= 1:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            a = i * j
            A.append(a%2019)
    print(min(A))

Solution (Python):
import sys
input=sys.stdin.readline







N,M = map(int,input().split())





if M -N >= 2019 or (N % 2019) > (M % 2019):
    print(0)
else:
    N = N % 2019
    M = M % 2019
    Min = 2019
    for i in range(N,M):
        for j in range(i+1,M+1):
            c = (i * j ) % 2019
            if c < Min:
                Min = c
    print(Min)

Solution (Python):
l,r = map(int,input().split())
cnt = 0
mod_list = []
if r- l >=2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            mod_list.append(i*j%2019)
    print(min(mod_list))

Solution (Python):
L,R = map(int,input().split())
N = R-L
if N >= 2019:
  print(0)
else:
  c = L*(L+1)%2019
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      x = i*j % 2019
      if c > x:
        c = x
  print(c)

Solution (Python):
L, R = map(int, input().split())
if L == 0 or L // 2019  != R // 2019:
    print(0)
else:
    mod_min = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            mod = (i * j) % 2019
            mod_min = min(mod_min, mod)
    print(mod_min)

Solution (Python):
L, R  = map(int, input().split())

if (2019-(L%2019))+L <= R:
  print(0)

else:
  ans = 2019
  for i in range(L,R):
    for j in range(i+1,R+1):
      ans = min(ans,(i*j)%2019)
  print(ans)

Solution (Python):
l,r = map(int, input().split())

q1 = l//2019
q2 = r//2019

if q1!=q2:
  print(0)
  exit()

r1 = l%2019
r2 = r%2019
ans = 2019
for i in range(r1,r2+1):
  for j in range(i+1,r2+1):
    rr = (i*j)%2019
    ans = min(ans,rr)
    if ans==0:
      print(ans)
      exit()
      
print(ans)

Solution (Python):
l,r=map(int,input().split())
ll=2019*(l//2019)
rl=2019*(r//2019)
li=l%2019
ri=r%2019
ans=2019
wk=0
if ll==rl:
  for i in range(li, ri+1):
    for j in range(i+1, ri+1):
      wk=(i*j)%2019
      if wk<ans:
        ans=wk
      if ans==0:
        break
else:
  ans=0
print(ans)

Solution (Python):
L,R=map(int,input().split())
if R-L>=2019:
	print(0)
else:
	ans=2018
	for i in range(L,R+1):
		for j in range(i+1,R+1):
			ans=min(ans,(i*j)%2019)
	print(ans)

Solution (Python):
L, R = map(int, input().split())
R = min(R, L+4038)
ans = 2018
for i in range(L, R):
    for j in range(i+1, R+1):
        ans = min((i*j)%2019, ans)
print(ans)

Solution (Python):
import itertools
L,R = map(int,input().split())
if 2019 <= (R - L) + 1:
  print(0)
  exit()
  
lst = list(range(L,R+1))
md = [x * y % 2019 for x,y in itertools.combinations(lst,2)]
md.sort()
print(md[0])

Solution (Python):
import sys
input = sys.stdin.readline
import math

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

l,r=MI()
mod=[]
if r-l>=2019:
    rm=0
    print(rm)
    sys.exit()
else:
    for i in range(l,r+1):
        mod.append(i%2019)

mn=10**7
for i in range(len(mod)-1):
    for j in range(i+1,len(mod)):
        
        
        ans=(mod[i]*mod[j])%2019
        if ans<mn:
            mn=ans
print(mn)

Solution (Python):
import itertools
L,R = map(int,input().split())
ans = 2019
for i,j in itertools.combinations(range(L,min(R+1,L+2020)), 2):
  ans = min(ans, i*j%2019)
print(ans)

Solution (Python):
a, b = map(int, input().split())
 
kleine = 2018
 
if b-a == 1:
	print((a*b)%2019)
elif b-a>= 2018:
	print(0)    
else:
	for i in range (a, b):
		for j in range (i+1, b+1):
			k = (i*j)%2019
			if k < kleine:
				kleine = k
			else:
				continue
	print(kleine)

Solution (Python):
l,r = map(int,input().split())

if r-l >= 2018:
  print(0)
else:
  ans = 2019
  for i in range(l,r):
    for j in range(i+1,r+1):
      ans = min(ans,(i*j)%2019)
  print(ans)

Solution (Python):
L, R = map(int,input().split())
if R - L >= 2018:
    print(0)
else:
    a = L % 2019
    b = R % 2019
    if b < a:
        b += 2019
    ans = 2018
    for i in range(a,b+1,1):
        for j in range(i+1,b+1,1):
            if ans > (i*j) % 2019:
                ans = (i*j) % 2019
    print(ans)

Solution (Python):
l,r=map(int,input().split())
if r-l>=2019: print(0)
else:
    ans=2018
    mod_l=l%2019
    mod_r=r%2019
    for i in range(min(mod_l,mod_r),max(mod_l,mod_r)+1):
        for j in range(i+1,max(mod_l,mod_r)+1):
            mod=(i*j)%2019
            if mod<ans: ans=mod
    print(ans)

Solution (Python):
L,R = map(int,input().split())
l = L%2019
r = R%2019
Min_Answer = 2018

if L//2019 == R//2019:
    for i in range(l,r+1):
        for j in range (i,r+1):
            if i ==j :
                continue
            Answer = (i*j) % 2019
            Min_Answer = min(Answer,Min_Answer)

else:
 Min_Answer = 0

print(Min_Answer)

Solution (Python):
L, R = map(int, input().split())
dif = R-L+1 if R-L+1<2019 else 2019

ans = 2018
for i in range(L, L+dif):
  for j in range(i+1, L+dif):
    ans = i*j%2019 if i*j%2019 < ans else ans
print(ans)

Solution (Python):
L, R = map(int, input().split())

ans = 2019
if(R-L >= 2019):
  for i in range(2019):
    for j in range(i+1, 2019):
      tmp = (i * j) % 2019
      if(tmp < ans):
        ans = tmp
else:
  d = L // 2019
  l = L % 2019
  r = R - (d*2019)
  for i in range(l, r+1):
    for j in range(i+1, r+1):
      tmp = (i * j) % 2019
      if(tmp < ans):
        ans = tmp
        
print(ans)

Solution (Python):
L, R = map(int, input().split())

if R - L >= 2019:
    ans = 0
else:
    l, r = L % 2019, R % 2019
    ans = 2018 ** 2
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            x = (i*j) % 2019
            ans = min(ans, x)

print(ans)

Solution (Python):
l, r = map(int, input().split())

mod = 2019
if l % mod == 0 or r % mod == 0 or l // mod != r // mod:
    print(0)
    exit()

ans = mod
for a in range(l, r):
    for b in range(a+1, r+1):
        if (a * b) % mod < ans:
            ans = (a * b) % mod
print(ans)

Solution (Python):
a, b = map(int, input().split())

c  = []
for i in range(a, min(b, a+2019) + 1):
    for j in range(i+1, min(b, a+2019) + 1):
        c.append((i * j) % 2019)

print(min(c))

Solution (Python):
L, R = map(int, input().split())
if R - L >= 2019:
    mn = 0
else:
    l, r = L % 2019, R % 2019
    mn = 2018 ** 2
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mn = min(mn, i * j % 2019)
print(mn)

Solution (Python):
l, r = [int(i) for i in input().split()]
if r - l >= 2018:
    print(0)
    exit()

mn = 2019
for i in range(l, r + 1):
    for j in range(l, r + 1):
        if i < j:    
            t = (i * j) % 2019
            mn = min(mn, t)

print(mn)