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())

ans = 2018**2
if R-L >= 2019:
    ans = 0
else:
    l, r = L % 2019, R % 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 math,numpy, collections

a,b = map(int,input().split())
ans = 2018**2
if b-a >=2019:
    ans = 0
else:
    aa, bb = a%2019,b%2019
    for i in range(aa,bb):
        for j in range(i+1,bb+1):
            ans = min(ans,i*j%2019)

print(ans)

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

Solution (Python):
import collections
import numpy as np
import sys
sys.setrecursionlimit(10000000)
import copy

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

Solution (Python):
import collections
import numpy as np
import sys
sys.setrecursionlimit(10000000)
import copy

L,R=map(int,input().split())
l=[]
for i in range(2021):
    l.append(L%2019)
    if L==R:
        break
    L+=1
ans=2019999
for i in range(len(l)):
    for j in range(i+1,len(l)):
        ans=min(l[i]*l[j]%2019,ans)
print(ans)

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

Solution (Python):
def abc133_c():
    L, R = map(int, input().split())
    
    if R - L > 673: return 0
    
    ans = 2019
    for i in range(L, R+1):
        for j in range(L, i):
            m = i * j % 2019
            ans = min(m, ans)
            if ans == 1: return 1
    return ans

print(abc133_c())

Solution (Python):
def abc133_c():
    L, R = map(int, input().split())
    
    if R - L > 673: return 0
    
    ans = 2019
    for i in range(L, R+1):
        for j in range(L, i):
            m = i * j % 2019
            ans = min(m, ans)
    return ans

print(abc133_c())

Solution (Python):


import numpy as np

def abc133_c():
    L, R = map(int, input().split())
    if R - L > 673: return 0
    x = np.arange(L, R+1, dtype=np.int64)
    
    y = x.reshape(-1, 1) * x.reshape(1, -1)  
    y %= 2019
    np.fill_diagonal(y, 2019)  
    return y.min()

print(abc133_c())

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

Solution (Python):
l,r = map(int,input().split())
num2019 = r//2019 - l//2019
ans = 9999999999
if num2019>=1 or l == 0 or l%2019 ==0:
    ans = 0
else:
    modr = r%2019
    modl = l%2019
    for a in range(l,r+1):
        for b in range(a+1,r+1):
            tmp = (a*b)%2019
            ans = min(ans,tmp)
print(ans)

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

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

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

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

Solution (Python):
l, r = list(map(int, input().split()))
ans = float('inf')
for i in range(l, r):
    for j in range(i + 1, r + 1):
        ans = min(ans, i * j % 2019)
        if ans == 0:
            break
    else:
        continue
    break
print(int(ans))

Solution (Python):
l,r = map(int,input().split())
if r-l >= 673:
    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):
import itertools
import math
import fractions
import functools
import copy

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

if r - l > 2019:
    print(0)
    quit()

minimum = 10**10
for i in range(l, r+1):
    for j in range(l, r+1):
        if(i != j):
            minimum = min(minimum, (i*j) % 2019)

print(minimum)

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

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

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

Solution (Python):
def f(l,r):
    p=2019
    for i in range(l,r+1):
        for j in range(l,r+1):
            if i==j:
                continue
            p=min((i*j)%2019,p)
    return p
    
l,r=map(int,input().split())
print(0 if r//2019-(l-1)//2019!=0 else f(l,r))

Solution (Python):
def f(l,r):
    p=2019
    for i in range(l,r+1):
        for j in range(l,r+1):
            if i==j:
                continue
            p=min((i*j)%2019,p)
    return p
    
l,r=map(int,input().split())
print(0 if r//2019-(l-1)//2019!=0 or (r//673-(l-1)//673!=0 and r//3-(l-1)//3!=0) else f(l,r))

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

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

    ans = 2018
    for i in range(L, min(R, L + 2018) + 1):
        p = i % 2019
        for j in range(i + 1, min(R, L + 2018) + 1):
            q = j % 2019
            t = p * q % 2019
            if ans > t:
                ans = t
    print(ans)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
def resolve():
    '''
    code here
    '''
    L, R = [int(item) for item in input().split()]
    aL, bL = divmod(L, 2019)
    aR, bR = divmod(R, 2019)

    if bL == 0:
        res = 0
    elif aL < aR:
        res = 0
    elif aL == aR:
        res = 2019
        for i in range(bL,bR):
            for j in range(bL+1,bR+1):
                res = min(res, i*j%2019)

    print(res)
if __name__ == "__main__":
    resolve()

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

ans = 2019
for i in range(l, r):
    for j in range(l+1, r+1):
        if ans == 0:
            break
        ans = min(ans, (i*j)%2019)
    else:
        continue
    break

print(ans)

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

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

def resolve():
    l,r=pin()
    L=l%2019
    R=r%2019
    
    if r-l>=2019:R+=2019


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

resolve()

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

ans=10000
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)
      exit()
print(ans)

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

ans=10000
th=l+min(r-l,2020)
for i in range(l,th):
  for j in range(i+1,th+1):
    ans=min(ans,(i*j)%2019)

print(ans)

Solution (Python):
L, R = map(int,input().split())
if R-L >= 2018:
    ans = 0
elif L%2019 > R%2019:
    ans = 0
else:
    ans = 2018
    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())
ans = float("INF")

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

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

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")











L,R = map(int,input().split())
c = 0
for i in range(L,R+1):
    if i % 2019 == 0:
        print(0)
        c = 1
        break
if c == 0:
    MIN = 3000
    for i in range(L,R):
        for j in range(i+1,R+1):
            a = (i*j)%2019
            MIN = min(a,MIN)
    print(MIN)

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

if R-L>2019:
    print(0)
else:
    lis = []
    for i in range(L, R):
        for j in range(i+1, R+1):
            lis.append((i*j)%2019)
    print(min(lis))

Solution (Python):
l,r = map(int,input().split())
ans = 10**10
for i in range(l,r+1):
    for j in range(i+1,r+1):
        x = (i*j)%2019
        if x==0:
            ans = 0
            break
        else:
            ans=min(ans,x)
    else:
        continue
    break
print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17


mod=2019
l,r=MI()
mn=inf
mods=[]



if (r-l)>=2018:
    ans=0
    
else:
    for i in range(l,r+1):
        mods.append(i%mod)
    for i in range(r-l+1):
        for j in range(i+1,r-l+1):
            u=(mods[i])*(mods[j])%mod
            if u<mn:
                mn=u
    ans=mn
print(ans)

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

l,r = iim()

if l//2019 != r//2019 or l%2019 == 0 or r%2019 == 0:
    print(0)
else:
    num = float('INF')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            num = min((i*j)%2019,num)
    print(num)

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

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

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

print(ans)

Solution (Python):
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

l,r=mp()
if l//2019 != r//2019:
    print(0)
    exit()
ans=10000
for i in range(l,r):
    for k in range(i+1,r+1):
        ans=min(ans,(i*k)%2019)
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 2019
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  





L, R = read_ints()
if R - L >= MOD:
    print(0)
    exit()

L = L % MOD
R = R % MOD

if R <= L:
    R += MOD

ans = INF
for i, j in combinations(ra(L, R + 1), r=2):
    
    ans = min(ans, i * j % MOD)
print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

l,r = inpl()
r = min(r,l+3000)
res = INF
for i in range(l,r):
    for j in range(i+1,r+1):
        res = min(res, (i*j)%2019)
print(res)

Solution (Python):
l, r = map(int, input().split())
if l//2019<r//2019:
    print(0)
else:
    ans = 2019
    for ll in range(l, r):
        for rr in range(ll+1, r+1):
            ans = min(ans, (ll*rr)%2019)
    print(ans)

Solution (Python):
def solve():
    L, R = map(int, input().split())
    mod = 2019
    table = [[0]*2019 for _ in range(2019)]
    for i in range(2019):
        for j in range(2019):
            table[i][j] = i*j%mod
    ans = 10**7
    if R-L>=2018:
        for i in range(2019):
            for j in range(i+1,2019):
                ans = min(ans,table[i][j])
        return ans
    r = R%mod
    l = L%mod
    if r>=l:
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                ans = min(ans,table[i][j])
        return ans
    for i in range(2019):
        if i<=r or i>=l:
            for j in range(i+1,2019):
                if j<=r or j>=l:
                    ans = min(ans,table[i][j])
    return ans
print(solve())

Solution (Python):
L,R = map(int,input().split())
a = [False for i in range(2019)]

for i in range(L,min(L+2019,R)+1):
    a[i%2019] = True
ans = 4000
for i in range(2019):
    if not a[i]:
        continue
    for j in range(i+1,2019):
        if not a[j]:
            continue
        ans = min(ans,i*j%2019)
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 2019


def resolve():
    L, R = map(int, input().split())

    for i in range(L, R + 1):
        if i % mod == 0:
            print(0)
            break
    else:
        res = f_inf
        for i in range(L, R):
            for j in range(L + 1, R + 1):
                calc = i * j % mod
                res = min(res, calc)

        print(res)


if __name__ == '__main__':
    resolve()

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

R=min(L+2019,r)

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



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


print(ans)

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

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

ans = 10 ** 9
if R - L >= 673:
    ans = 0
else:
    for i in range(L, R):
        for j in range(L + 1, R + 1):
            work = (i * j) % 2019
            
            ans = min(ans, work)

print(ans)

Solution (Python):
L,R = map(int,input().split())
m = 2019
sa = R//m - L//m
if sa == 0:
  ans = float("inf")
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      ans = min(ans,i*j%m)
  print(ans)
if sa >= 1:
  print(0)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 2019

L, R = map(int, input().split())

R = min(R, L + 2019)

ans = 2019
for l in range(L, R + 1):
    for r in range(l + 1, R + 1):
        ans = min(ans, l * r % MOD)

print (ans)

Solution (Python):
def examA():
    S = SI()
    T = SI()
    N = len(S)
    ans = "No"
    for i in range(N):
        cur = S[i:] + S[:i]
        
        if cur==T:
            ans = "Yes"
    print(ans)
    return

def examB():
    H, W = LI()
    S = [SI()for _ in range(H)]
    flag = True
    ans = 0
    print(ans)
    return

def examC():
    L, R = LI()
    ans = inf
    if R-L>=3000:
        R = L+3000

    for l in range(L, R + 1):
        for r in range(l+1, R + 1):
            now = (l*r) %2019
            ans = min(ans,now)
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Solution (Python):
def main():
    L, R = (int(i) for i in input().split())
    ans = 2*10**9
    for le in range(L, min(R, L+2020)+1):
        for ri in range(le+1, min(R, L+2020)+1):
            cur = le*ri
            cur %= 2019
            ans = min(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    l, r = map(int, input().split())
    if l + 2019 <= r:
        print(0)
    else:
        ans = float("inf")
        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())
m=l//2019
l-=m*2019
r-=m*2019
ans=2018
if r>=2019:exit(print(0))
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 >= 2040:
    print(0)
    exit(0)

res = 10 ** 100
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        res = min(res, i * j % 2019)
print(res)

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

reg = 2018
if R-L >= 3000:
    print(0)
else:
    for l in range(L, R):
        for r in range(l+1, R+1):
            tmp = (l * r) % 2019
            reg = min(reg, tmp)
    print(reg)

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

Solution (Python):
L, R = map(int, input().split())
if R >= L + 2019:
    R = R + 2019

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

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

z = 2019

if R-L>= 2019:
    print(0)
else:
    for l in range(L,R):
        for r in range(l+1, R+1):
            z = min(z, ((l % 2019) * (r % 2019)) % 2019)
    print(z)

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

Solution (Python):
L, R = map(int, input().split())
"""
ans = 0
if R - L < 2019:
    l = L % 2019
    r = R % 2019
    if l < r:
        l_ = (L * (L + 1)) % 2019
        r_ = (R * (R - 1)) % 2019
        ans = min(l_, r_)
print(ans)
"""  

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

print(ans)

Solution (Python):


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

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

Solution (Python):

"""
Created on Tue May 12 13:43:11 2020

@author: shinba
"""
import sys 
import itertools

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

if l % 2019 == 0:
    print(0)
    sys.exit()
else:
    if l//2019 +1 <= r/2019:
        print(0)
        sys.exit()

l %= 2019
r %= 2019
ans = float("inf")

for i in itertools.combinations(range(l,r+1),2):
    mod = (i[0]*i[1])%2019
    ans = min(mod,ans)
    
print(ans)

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

if L // 2019 != R // 2019:
    print(0)
else:
    ans = float("inf")
    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):
n, m = list(map(int,input().split()))

res = 10**9
for i in range(n, m):
    for j in range(i+1, m+1):
        res = min(res, (i*j % 2019))
        if res == 0:
            print(0)
            exit()
print(res)

Solution (Python):
l,r=map(int,input().split())
i=1
temp=0
while r>2019*i:
  if l<=2019*i:
    temp=1
    break
  i=i+1

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

if temp==1:
  print(0)
else:
  print(count)

Solution (Python):
from collections import deque
from itertools import accumulate
import sys
sys.setrecursionlimit(10**6)

mo=10**9+7

l,r=map(int,input().split())
r=min(l+2019+10,r)

ans=2018
for i in range(l,r):
    for j in range(l+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:
    m = 10**6
    for i in range(L, R):
        for j in range(i+1, R+1):
            m = min((i*j)%2019, m)
    print(m)

Solution (Python):
import sys
L,R = map(int,input().split())
i = L
j = i+1
p =2019
min_ij = ((i%p)*(j%p))%p
for i in range(L,R):
  for j in range(i+1,R+1):
    if i % p == 0 or j %p == 0:
      print(0)
      sys.exit()
    if min_ij > ((i%p)*(j%p))%p:
      min_ij = ((i%p)*(j%p))%p

print(min_ij)

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

nl = l%MOD
diff = r-l
li1 = []
li2 = []

if diff>2018:
  print(0)
else:
  for i in range(diff+1):
    li1.append(nl+i)
  for j in range(len(li1)):
    for k in range(j+1,len(li1)):
      li2.append(li1[j]*li1[k]%MOD)
  print(min(li2))

Solution (Python):

[L,R] = list(map(int,input().split()))

flag=0
for i in range(L,R+1):
    if i%2019 == 0:
        flag=1
        break

LL = L%2019
RR = R%2019
dammy=[]
for i in range(LL,RR):
    for j in range(i+1,RR+1):
        dammy.append((i*j)%2019)

if flag==0:
    print(min(dammy))
else:
    print(0)

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

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

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

print(ans)

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

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

for i in range(L,R+1,1):
    if i%2019 == 0:
        print(0)
        exit()

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

print(ans)

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

for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans = i*j%2019
        if(a > ans):
            a = ans
        if ans == 0:
            print(a)
            exit(0)
print(a)

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

for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans = i*j%2019
        if(a > ans):
            a = ans
        if ans == 0:
            print(a)
            exit(0)
print(a)

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

if(R-L > 2019):
    R = L+2019
for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans = i*j%2019
        if(a > ans):
            a = ans
print(a)

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

r = min( r, l + 2019 )

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

print( min_ixj )

Solution (Python):
def ABC133C(l, r):
    Min = 1e10
    for i in range(l, r):
        for j in range(i+1, r+1):
            a = (i * j) % 2019
            if a < Min:
                Min = a
                if a == 0: 
                    print(Min)
                    return
    print(Min)

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

Solution (Python):
import numpy as np

def ABC133C(l, r):
    Min = np.inf
    for i in range(l, r):
        for j in range(i+1, r+1):
            a = (i * j) % 2019
            if a < Min:
                Min = a
                if a == 0: 
                    print(Min)
                    return
    print(Min)

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

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

a = 0
ans = 10 ** 9
r = min((L + 2018), R)

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

Solution (Python):
l,r=map(int,input().split())
a=range(l,r+1)
m=float('inf')
for i in a:
    for j in range(i+1,r+1):
        m=min(m,(i*j)%2019)
        if m==0:
            print(0)
            exit()
print(m)

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

Solution (Python):
l,r = map(int,input().split())
r = min(r,l+2017)
ans = 2018
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())
lista = []
for i in range(L, min(R + 1, L + 2019)):
    lista.append(i % 2019)
ans = float('inf')
for i in range(len(lista)):
    for j in range(i + 1, len(lista)):
        ans = min(ans, lista[i] * lista[j] % 2019)
print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

L, R = MAP()

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

a = list(range(L, R+1))
ans = 2019

for x, y in combinations(a, 2):
	ans = min(ans, (x*y)%2019)

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

L, R = MAP()

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

a = list(range(L, R+1))
ans = 2019

for x, y in combinations(a, 2):
	ans = min(ans, (x*y)%2019)

print(ans)

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

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

int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): return k.join(list(map(str, lst)))
INF = float('inf')

def solve():
    l, r = MI()
    mod = 2019

    r = min(r, l+673)
    ans = 2018
    for i in range(l, r):
        for j in range(i+1, r+1):
            ans = min(ans, i * j % mod)

    print(ans)
if __name__ == '__main__':
    solve()

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