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

x, y=l//2019, r//2019

p=0

if x==y:

	p=2019

	for i in range(l, r):

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

			p=min(p, (((i%2019)*(j%2019))%2019))

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

x, y=l//2019, r//2019

p=0

if x==y:

	p=2019

	for i in range(l, r):

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

			p=min(p, (((i%2019)*(j%2019))%2019))

			if not p:

				break

		if not p:

			break

print(p)
l, r = list(map(int, input().split()))
x, y = l // 2019, r // 2019
p = 0
if x == y:
    p = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            p = min(p, (((i % 2019) * (j % 2019)) % 2019))
print(p)

l, r = list(map(int, input().split()))
x, y = l // 2019, r // 2019
p = 0
if x == y:
    p = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            p = min(p, (((i % 2019) * (j % 2019)) % 2019))
            if not p:
                break
        if not p:
            break
print(p)

+            if not p: +                break +        if not p: +            break