peterverebics/CodeNet_Python_118 huggingface dataset:
L,R=map(int,input().split())
l=L%2019
r=R%2019
if l<r:
  c=2020
  a=list(range(l,r+1))
  for i in range(len(a)-1):
    for j in range(i+1,len(a)):
      s_=a[i]*a[j]
      s=s_%2019
      c=min(c,s)
else:
  r+=2019
  c=2020
  a=list(range(l,r+1))
  for i in range(len(a)-1):
    for j in range(i+1,len(a)):
      s_=a[i]*a[j]
      s=s_%2019
      c=min(c,s)
print(c)
l,r = map(int,input().split())
if l - r >= 2019:
     print(0)
else:
     s = l % 2019

     if s + r - l >= 2019:
          print(0)
     else:
          print((s*(s+1))%2019)
import sys

L, R = map(int, input().split())
m = 10*100
for i in range(L, R):
    for j in range(i+1, R+1):
        tmp = (i*j)%2019
        if tmp == 0:
            print(0)
            sys.exit()
        else:
            m = min(m, tmp)

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

l %= 2019
r %= 2019

if l >= r:
    print(0)
    exit()

ans = 2018

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

print(ans)
l,r=map(int,input().split())
l_mod=l%2019
r_mod=r%2019
l_div=l//2019
r_div=r//2019
if l_div<r_div:
  print(0)
else:
  print(l_mod*(l_mod+1))
l,r=map(int,input().split())
x=[]
if r-l>=2018:
    print(0)
else:
    for i in range(l,r+1):
        x.append(i%2019)
    x.sort()
    print((x[0]*x[1])%2019)
l, r = map(int, input().split())

l2 = l // 2019
r2 = r // 2019

if l2 != r2:
  print(0)
else:
  ans=2019
  for i in range(l2, r2):
    for j in range(i+1, r2 + 1):
      ans = min(ans, (i * j)  % 2019)
  print(l * (l + 1) % 2019)
L, R = map(int, input().split())
l = L % 2019
if l + R - L >= 2019:
    ans = 0
else:
    ans = (l * (l + 1)) % 2019
print(ans)
L, R = [int(i) for i in input().split()]
diff = R - L
ans = 2019
if diff == 1:
    x = (L * (L + 1)) % 2019
    print(min(x, ans))
else:
    for i in range(diff):
        for j in range(i + 1, diff):
            x = ((L + i) * (L + j)) % 2019
            ans = min(x, ans)
            if x == 0:
                break
    print(ans)
l,r=list(map(int,input().split()))
s=[]
if r-l>2019:
  print(0)
else:
  for i in range(l,r+1):
    s.append(i%2019)
  s.sort()
  print(s[0]*s[1])
L,R = (int(x) for x in input().split())
if (R-L)//2019:
  R -= (R-L)//2019*2019
ans = 2018
for i in range(L,R):
  for j in range(i+1,R+1):
    ans = min(ans,(i*j)%2019)
print(ans)
M=2019;l,r=map(int,input().split());l%=M;r%=M
print(0 if l>r or r-l>671 else min(i*j%M for i in range(l,r) for j in range(i+1,r+1)))
L, R = map(int, input().split())
ans = 2019
if R - L >= 2019:
    print(0)
else:
    for i in range(L, R + 1):
        for j in range(L + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
    print(ans)
l, r = list(map(int,input().split()))

mins = 10**9
for i in range(l, r):
  mins = min( (i * (i+1))%2019, mins)
  if mins == 0:
    break
    
print(mins)
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()
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)
# coding: utf-8

#N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
L = []
l, r = map(int,input().split())

if r-l+1 > 2019:
    ans = 0
else:
    for i in range(l, r+1):
        L.append(i%2019)
    L.sort()
    print((L[0]*L[1])%2019)
l,r = map(int,input().split())
ans = 2019

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

print(ans*(ans+1))
i,j = map(int,input().split())
a,b = divmod(i,2019)
c,d = divmod(j,2019)


if c-a > 0:
    ans = 0
else:
    ans = b*(b+1)
print(ans)
ll, rr = map(int, input().split())
if rr - ll >= 2019:
    print(0)
    exit()

l = ll % 2019
r = rr % 2019

if l > r:
    print(0)
    exit()
print(l,r)
ans = 10**9
for i in range(l, r + 1):
    for j in range(i+1, r+1):
        x = (i * j) % 2019
        print(x)
        ans = min(x, ans)

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

l %= 2019
r %= 2019

mina = float('INF')

for x in range(l,r+1):
    for y in range(x,r+1):
        if(x==y):
            continue
        ans = (x * y) % 2019
        if(mina > ans):
            mina = ans
        
print(mina)
L, R = map(int, input().split())

def mod(num):
    return num % 2019


#  (2019a + x)(2019b + y) = 2019(n) + xy

if mod(L) * mod(R) == 0:
    print(0)

elif L // 2019 != R // 2019:
    print(0)

else:
    print(min(mod(L * (L + 1)), mod((R - 1) * R)))
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')
            break
print(m)
#abc133 c
L,R=map(int,input().split())
ans=0
R=min(R,L+2019*2)
ans=2018
amari=[]
for i in range(L,R+1):
    tmp=i%2019
    amari.append(tmp)
    if len(amari)==2019*2:
        break
for i in range(len(amari)):
    for j in range(len(amari)):
        if i==j:
            continue
        ans=min(ans,(amari[i]*amari[j]*2019))
        if ans==0:
            break
print(ans)
l,r = map(int,input().split())
a = l%2019
b = r-l
if a+b >= 2019:
    print(0)
else:
    c = []
    for i in range(l,r+1):
        c.append(i%2019)
    c = sorted(c)
    print(c[0]*c[1])
l, r = map(int, input().split())

i = l
j = i + 1
count = 0
arr = []
while(True):
    if count == 10000 or j == r:
        break
    else:
        arr.append((i*j) % 2019)
        j += 1
        count += 1
if len(arr) == 0:
    arr.append((l*r) % 2019)
        
print(min(arr))
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    l, r = map(int, input().split())
    ans = float("inf")
    if r - l >= 2500:
        ans = 0
    else:
        for i in range(l, r):
            ans = min((i*(i+1) % 2019), ans)
    print(ans)


if __name__ == "__main__":
    main()
l, r = map(int, input().split())

if (r % 2019 == 0) or (l % 2019 == 0) or (r-l >= 2019):
    print('1')
else:
    min_num = 2020
    for left in range(l, r):
        for right in range(left+1, r+1):
            mod = (left * right) % 2019
            min_num = min(min_num, mod)
    print(min_num)
L, R = map(int,input().split())
mul_3 = R//3 - (L - 1)//3
mul_673 = R//673 - (L - 1)//673
mul_2019 = R//2019 - (L - 1)//2019

if min(mul_3,mul_673) >= 1 or mul_2019 >= 1:
    print(0)
else:
    ans = float('inf')
    for num in range(L, R):
        ans = min(ans, (num % 2019) * (num + 1) %2019)
    print(ans)
L, R = map(int, input().split())
MOD = 2019
x = L % MOD
y = R % MOD

if -(-L//MOD) == (R-1)//MOD:
    print(0)
elif x <= 3 and 693 <= y:
    print(0)
else:
    print(x*(x+1) % MOD)
l,r = map(int,input().split())
m = 2018
if r-l>=2019:
  print(0)
else:
  for i in range(l,r):
    for j in range(i+1,r+1):
      a = (i*j)%2019
      m = min(a,m)
print(m)
l,r = map(int,input().split())

x = []

for i in range(l,r+1):
    x.append(i%2019)
    
x.sort()
    
print(x[0]*x[1]%2019)
L, R = map(int, input().split())
modL = L % 2019
modL1 = (modL + 1) % 2019
if modL == 0 or (L <= 2018 and R >= 2019):
    print(0)
else:
    print((modL * (modL1)) % 2019)
import sys
l,r = map(int,input().split())
c = 10**9
if r - l >= 2019:
    print(0)
    sys.exit()
for i in range(l,r):
    for j in range(i+1,r+1):
        print(i,j)
        x = (i * j) % 2019
        print(x)
        if x < c:
            c = x
    
print(c)
L,R = map(int,input().split())
l = L%2019
r = R%2019
Min_Answer = 2018


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

print(Min_Answer)
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    L, R = input_nums()
    MOD = 2019
    a = L%MOD
    b = R%MOD
    if a < b:
        print((a*(a+1))%MOD)
    else:
        print(0)

if __name__ == '__main__':
    main()
l, r = map(int, input().split())

mod = min(l%2019, r%2019)
print(mod*(mod+1))
l,r = list(map(int, input().split()))

l1 = l%2019
if r >= l + 2019 - l1:
    r1 = 2018
else:
    r1 = r%2019

ans = float("inf")
for i in range(l1,r1):
    for j in range(i+1, r1+1):
        ans = min(ans, (i*j%2019))

print(ans)
def nyu():
    L,R = map(int,input().split())
    return L,R


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(ll+1,LR+1):
            print(ll,"  ",lr)
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
ML,MR = convert(ML,MR)
kansu(ML,MR)
l,r=map(int,input().split())
if r%2019<=l%2019:print(0)
else:print(l*(l+1)%2019)
L,R=map(int,input().split())
ans=0
if R-L>=673:
  print(0)
  exit()
if R*(R-1)<=2018:
  print(L*(L+1))
  exit()
for i in range(R-L):
  for j in range(R-L):
    if ans>i*j%2019:
      ans=i*j%2019
print(ans)
def LI():
    return list(map(int, input().split()))


L, R = LI()
ans = 2020
for i in range(L, R+1):
    x = (i*i) % 2019
    for j in range(i, R+1):
        y = (i*j) % 2019
        ans = min(ans, x)
        if x == y:
            break
    if ans == 0:
        break
print(ans)
l, r = map(int, input().split())
rem = []
mod = 2019
if r - l + 1 > 2019:
    ans = 0
else:
    for i in range(l, r+1):
        rem.append(i % mod)
    rem.sort()
    ans = rem[0]*rem[1] % mod
    # print(rem[0], rem[1])
print(ans)
l, r = map(int, input().split())
l_2 = l%2019
r_2 = r%2019
ans = 2019
if r_2 - l_2 > 2017:
    print(0)
else:
    for i in range(l_2,r_2+1):
        for j in range(i+1,r_2+1):
            print(i,j)
            tmp = i*j%2019
            if tmp < ans:
                ans = tmp
    print(ans)
l, r = map(int, input().split())

x = 2018
cnt = 0
for i in range(l, r+1):
    a = i%2019
    if a == 0:
        print(0)
        exit()
    x = min(a, x)
print(x*(x+1))
L,R = map(int,input().split())
L = L%2019 
R = R%2019
ans = 2018
for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans=min(ans,i*j)
print(ans)
l,r=map(int,input().split())
if r-l>2019:
    print(0)
    exit()

ans=int(10000000)
for i in range(l,r):
    for j in range(i+1,r+1):
        if ans>i*j:
            ans=i*j

print(ans)
l,r=map(int,input().split())
s=10000
for i in range(l,r+1):
    if i%2019==0:
        s=0
    elif (i%673==0 and r-l!=1) or (i%673==0 and (r%3==0 or l%3==0)):
        s=0
if s==0:
    print(0)
else:
    print(((l%2019)*((l+1)%2019))%2019)
import sys, heapq, bisect, math, fractions
from collections import deque

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

modL = L % mod
modR = R % mod

if R - L >= 2018:
    print(0)
else:
    if modL > modR:
        print(0)
    else:
        print(modL * ((modL + 1) % mod) % mod)
l,r=map(int,input().split())
x=[]
if r-l>=2018:
    print(0)
else:
    for i in range(l,r+1):
        x.append(i%2019)
    x.sort()
    print(x[0]*x[1])
i, j = map(int, input().split())
MOD = 2019
ans = float("inf")
for x in range(i, min(j+1, i+MOD)):
    for y in range(i+1, min(j+1, i+MOD)):
        ans = min(ans, x%MOD * y%MOD)
print(ans)
l, r = [int(i) for i in input().split()]
ln = l // 2019
rn = r // 2019
if ln == rn:
	l = l % 2019
	print (l * (l + 1))
else:
	print (0)
def solve():
    i = L//2019
    ans = 0
    while L <= 2019*i <= R:
        i += 1
#    print(i)
    if i >= 1:
        print(ans)
    else:
        ans = (L*(L+1)) % 2019
        print(ans)


if __name__ == "__main__":
    L,R = list(map(int, input().split()))
    solve()
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    if R - L >= 10000:
        print(0)
    else:
        A = [i % 2019 for i in range(L, R + 1)]
        A.sort()
        print(A[0] * A[1])

    return


if __name__ == '__main__':
    main()
# 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 LLI(rows_number): return [LI() for _ in range(rows_number)]


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

    lst = []
    for i in range(0, min(pow(2019, 2), r-l)+1):
        t = (l + i) % mod
        lst.append(t)
        # print(t)
    lst.sort()
    print(lst[0] * lst[1])


if __name__ == '__main__':
    solve()
l,r=map(int,input().split())
lmod673=l%673
rmod673=r%673
lmod2019=l%2019
rmod2019=r%2019

if lmod2019==0 or lmod2019>rmod2019:
    print(0)
elif rmod2019-lmod2019>=673:
    print(0)
elif lmod673>rmod673 or lmod673==0:
    if r-l>=2:
        print(0)
    elif (lmod2019*rmod2019)%3==0:
        print(0)
    else:
        print(lmod2019*(lmod2019+1))
else:
    print(lmod2019*(lmod2019+1))
L, R = map(int, input().split())
  
if R - L >= 2018:
  print(0)
  exit()
  
lst = []
for i in range(L,R+1):
  lst.append(i%2019)
  
lst.sort()

print(lst[0]*lst[1]%2019)
l,r=map(int,input().split())

mod=2019
sa=r-l
ans=float('inf')
if 2019<=sa:
  print(0)
else:
  for i in range(l,r+1):
    for j in range(l,r+1):
      if i<j:
        ans=min((i%mod)*(j%mod),ans)
  print(ans)
a, b = map(int,input().split())
num = [a%2019]
num.append(b%2019)

for i in range(a + 1,b):
  if(max(num) > (i % 2019)):
    num.append(i%2019)
    num.remove(max(num))
  elif(i % 2019 == 0):
    print(0)
    break

print(num[0] * num[1])
L,R=map(int,input().split())

min_val = 2019
flag = 1
for i in range(L,R):
  tmp = (i*(i+1)) % 2019
  if tmp == 0:
    flag = 0
    break
  elif tmp < min_val:
    min_val = tmp
if flag == 0:
  print(0)
else:
  print(min_val)
L,R=[int(x) for x in input().strip().split()]

ans=10**9+1


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

print(ans)
l,r = map(int,input().split())
if l - r >= 2019:
     print(0)
else:
     s = l % 2019

     if s + l - r >= 2019:
          print(0)
     else:
          print(s*(s+1))
#!/usr/bin/env python3


def main():
    L, R = map(int, input().split())
    if R - L > 2017:
        print(0)
        return
    ans = min([n % 2019 for n in range(L, R + 1)])
    ans = ans * (ans + 1)
    print(ans)


if __name__ == '__main__':
    main()
l, r = map(int, input().split())
l, r = l%2019, r%2019

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

if r-l>=2019:
  print(0)
else:
  m=2019
  for i in range(l,r+1,1):
    for j in range(l,r+1,1):
      m=min(i*j%2019,m)
  print(m)
l,r = map(int,input().split())
i = -(-l//2019)
if 2019*i<=r:
    print(0)
else:
    if r%2019<l%2019:
        print(r%2019*(r-1)%2019)
    else:
        print(l%2019*(l+1)%2019)
l,r=map(int,input().split())
x=[]
if (r-l)>=2019:
    print(0)
else:
    for i in range(l,r+1):
        x.append(i%2019)
    x.sort()
    print((x[0]*x[1])%2019)
def main():
    import sys
    input=sys.stdin.readline
    L,R=map(int,input().split())

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

if __name__=="__main__":
    main()
L,R = map(int,input().split())
if L==R:
  print(L%2019 * L%2019)
  exit()
if R-L >= 2019:
  print(0)
  exit()

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

    res = min(res, i*j)

print(res)
import sys
from heapq import heappush, heappop
#input = sys.stdin.readline

def main():
    l,r=map(int,input().split())
    if r-l>=2019:
        print(0)
    else:
        ans=[]
        for i in range(l,r+1):
            ans.append(i%2019)
        ans.sort()
        print((ans[0]*ans[1])%2019)

if __name__ == '__main__':
    main()
l,r=map(int,input().split())

cnt=[]


for i in range(l,r+1):
  if i%2019!=0:
    for j in range(l,r+1):
      if j%2019>=0:
        a=(l*(l+1)%2019)
        cnt.append(a)
        break
      else:
        a=(j*(j-1)%2019)
        cnt.appnd(a)
        break
print(min(cnt))
l,r = map(int, input().split())
d,e = map(lambda x: x%2019, (l,r))
print((d*(d+1))%2019) if d < e else print(0)
L, R = map(int, input().split())
L %= 2019
R = R % 2019 if R - L < 2019 else R % 2019 + 2019
print(L, R)
ans = float('inf')
for i in range(L, R):
    for j in range(i+1, R+1):
        ans = min(ans, (i*j) % 2019)
print(ans)
# https://atcoder.jp/contests/abc133/tasks/abc133_c

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

dp = [0] * 2019 
for i in range(2019 * 3):
    n = l + i
    if n <= r:
        m = n % 2019
        dp[m] += 1
    else:
        break

ans = 1
c = 0
i = 0
while i < len(dp):
    if dp[i]:
        ans *= i
        dp[i] -= 1
        c += 1
    else:
        i += 1
    if c == 2:
        break
print(ans)
L, R = map(int, input().split())

ans = 10**9
for i in range(L, R):
    for j in range(i+1, R+1):
        tmp = (i*j) % 2019
        if tmp == 0:
            print(ans)
            exit(0)
        else:
            ans = min(ans, tmp)
print(ans)
l,r = list(map(int,input().split()))

l %= 2019
r %= 2019

L = min(l,r)
R = max(l,r)

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

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

Lmod = L%2019
Rmod = R%2019

if (R-L+1) <= 2019 and Lmod < Rmod:
    print((L*(L+1))%2019)
elif (R-L+1) <= 2019 and Lmod > Rmod:
    print(0)
elif (R-L+1) > 2019:
    print(0)
import sys
l,r = map(int,input().split())
l=l%2019
r=r%2019
if l>=r or l+2019 <= r:
  print(0)
  sys.exit()

ans=2018
for i in range(l,r):
  if ans == 0:
    break
  for j in range(i+1,r+1):
    ans = min(ans,i*j%2019)
    if ans == 0:
      break
print(ans)
import math
L, R = map(int, input().split( ))
mod = 2019
#(i*j mod) = (i mod)*(j mod)
m = 2018
s, t = L%2019, R%2019
d = (R - L)//2019
if d >= 1:
  print(0)
  exit()
if t < s:
  print(0)
else:
  print(s*(s+1))
L,R=[int(x) for x in input().strip().split()]

ans=10**9+1
for i in range(L,R+1,1):
  if i%2019==0:
    break
  for j in range(L,R+1,1):
    if j%2019==0:
      break

    if i<j:
      ans=min((i*j)%2019,ans)
print(ans)
def nyu():
    L,R = map(int,input().split())
    return L,R


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(LL+1,LR+1):
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
ML,MR = convert(ML,MR)
kansu(ML,MR)
l,r=map(int, input().split())
l%=2019
r%=2019
res = 100000000
for i in range(min(l,r),max(l,r)):
    for j in range(i+1, max(l,r)+1):
        res = min(res,(i*j)%2019)
print(res)
l,r=map(int,input().split())
l=l%2019
r=r%2019
if (l<=1009 and r<=1009) or (l>1009 and r>1009):
    print((l*(l+1))%2019)
else:
    print(0)
def solve():
    L, R = map(int, input().split())

    if L + 2019 < R:
        return 0
    
    list = [i % 2019 for i in range(L, R+1)]
    list.sort()
    return (list[0] * list[1]) % 2019

print(solve())
L, R = map(int, input().split())
if R - L > 2019:
  print(0)
else:
  l = []
  for i in range(L, R + 1):
    for j in range(i, R + 1):
      l.append(i * j % 2019)
  print(min(l))
l,r=map(int,input().split())
a=[]
for i in range(l,min(l+2020,r+1)):
  a.append(i%2019)
a.sort()
print((a[0]*a[1])%2019)
L, R = map(int, input().split())
 
L2 = L%2019
R2 = R%2019

if L2 == 0 or R2 == 0:
    print(0)
    exit()

if L + 2019 < R:
    print(0)
    exit() 
 
length = abs(R2-L2+1)
ans = []
for i in range(length):
    if L2 < R2:
        k = (L2+i) % 2019
        ans.append(k)
    elif L2 > R2:
        k = (R2+i) % 2019
        ans.append(k)
 
list.sort(ans)
print(ans)
print((ans[0]*ans[1])%2019)
L,R=map(int,input().split())
if L+1==R: print((L*R)%2019)
else:
    c=0
    while (c+1)*2019<R: c+=1
    if c*2019<L: print((L*(L+1))%2019)
    else: print(((c*2019)*((c*2019)+1))%2019)
l , r = map(int,input().split())
lt = l % 2019
rt = r % 2019

if rt - lt <= 0:
    print(0)
else:
    print(min(lt*(lt+1),(2019-rt)*(2020-rt)))
L, R = list(map(int, input().split()))
l = L%2019
print(l * (l+1) % 2019)
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    l,r=map(int,input().split())
    l_m=l%2019
    r_m=r%2019
    if l//2019==r//2019:
        print(l_m*(l_m+1)%2019)
    else:print(0)

if __name__=='__main__':
    main()
L,R = map(int,input().split())
if R-L+1>=673:
    print(0)
else:
    cmin = 2019
    for i in range(L,R-1):
        for j in range(i+1,R):
            cmin = min(cmin,(i*j)%2019)
    print(cmin)
def main():
    mod = 2019
    l,r = map(int,input().split())
    m1 = 10**9
    m2 = 10**9
    for i in range(l,r+1):
        tmp = i%mod
        if m1>tmp:
            m2 = m1
            m1 = tmp
        elif m2>tmp:
            m2 = tmp
    print(m1*m2)
main()
import sys
L, R = list(map(lambda x: int(x), input().split()))
# この場合は0,1,2,~~2018の数字がmodで出てくる。ので最小値は決まっている。
if R - L >= 2018:
  print(0)
  sys.exit()

one = L % 2019
two = (L + 1) % 2019

print(one * two)
l,r = map(int,input().split())

if r < 2019:
    print(l*(l+1)%2019)
    exit()

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

#ここのケースで間違ってんのがいくつかある
# ans = (l*(l+1))%2019
# print(ans)
L, R = map(int, input().split())
for i in range(1000000):
    for j in range(2019):
        if L<= 2019*i+j < R:
            print(j*(j+1))
            break
L, R = map(int, input().split())
MOD = 2019
L %= MOD
R %= MOD
if L > R:
    L, R = R, L
print(min(i * j % 2019 for i in range(L, R) for j in range(i + 1, R + 1)))
import sys
l, r = map(int, input().split())
ans = l*r%2019
for i in range(l, r-1):
  for j in range(i+1, r):
    if i*j%2019 == 0:
      print(0)
      sys.exit()
    elif ans > i*j%2019:
      ans = i*j%2019
print(ans)
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

L,R  = nm()
if R -L >= 673:
    print(0)

ans = 2019
for i in range(L,R):
    for j in range(1+L,R+1):
        ans  = min(ans,(i * j) % 2019)
    
print(ans)
L, R = map(int, input().split())
s = L % 2019
w = R - L
if s + w >= 2019:
  print(0)
else:
  print(s * (s + 1))
l,r = map(int, input().split())
if l%2019==0 or r%2019==0:print(0)
elif r < 2019: print((l*(l+1))%2019)
else:
    n = 2019
    i = 1
    while l > n:
        n *= i
        i += 1
    n = [n-2019, n]
    if l <= n[0] <= r or l<= n[1] <= r: print(0)
    else:
        print(min(l - n[0], n[1] - r)+1)
l,r = map(int,input().split())
mod = 2019
r = (r%mod) + 2019*(r-l>=2019)
l = l%mod
ans = float("inf")
for i in range(l,r):
  for j in range(i+1,r+1):
    ans = (i*j)%mod
print(ans)
L,R=map(int,input().split())
ans=float('inf')
for i in range(L,R+1):
  for j in range(L+1,R+1):
    s=(i*j)%2019
    
    if s==0:
      print(0)
      exit()
    else:
      ans=min(s,ans)
      
print(ans)
l, r = map(int, input().split())
ans = 4070306
if l <= 2019 <= r:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1, r+1):
            ans = min(ans, (i*j)%2019)
print(ans)
l,r = map(int, input().split())

if r//673 > (l-1)//673 and r//3 >(l-1)//3:
  print('0')

else:
    a=((l%2019) * ((l+1)%2019) % 2019)
    b=((l%2019)%2019 * ((l+1)%2019))
    print(min(a,b))
l ,r = map(int, input().split())
if l % 2019 + (r - l) >= 2019:
    print(0)
else:
    print((l % 2019) * ((l + 1) % 2019) % 2019)