a,b = list(map(int,input().split()))

min_mod = 2018



if b-a > 2019:

	min_mod=0



else:	

	for aa in range(a,b):

	   for bb in range(a+1,b+1):

	       if aa < bb:

	           cc=aa*bb

	 

	           if min_mod > cc%2019:

	               min_mod = cc%2019



print(min_mod)



a,b = list(map(int,input().split()))

min_mod = 2018



if b-a > 2019:

	min_mod=0



else:	

	for aa in range(a,b):

	   for bb in range(aa+1,b+1):

	       if aa < bb:

	           cc=aa*bb

	 

	           if min_mod > cc%2019:

	               min_mod = cc%2019



print(min_mod)

a, b = list(map(int, input().split()))
min_mod = 2018
if b - a > 2019:
    min_mod = 0
else:
    for aa in range(a, b):
        for bb in range(a + 1, b + 1):
            if aa < bb:
                cc = aa * bb
                if min_mod > cc % 2019:
                    min_mod = cc % 2019
print(min_mod)

a, b = list(map(int, input().split()))
min_mod = 2018
if b - a > 2019:
    min_mod = 0
else:
    for aa in range(a, b):
        for bb in range(aa + 1, b + 1):
            if aa < bb:
                cc = aa * bb
                if min_mod > cc % 2019:
                    min_mod = cc % 2019
print(min_mod)

-        for bb in range(a + 1, b + 1): +        for bb in range(aa + 1, b + 1):