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

if r-l>672:

	p=0

else:

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

if r-l>672:

	p=0

else:

	p=2019

	for i in range(l, r):

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

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

			if not p:

				break

		if not p:

			break

print(p)
l, r = list(map(int, input().split()))
if r - l > 672:
    p = 0
else:
    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()))
if r - l > 672:
    p = 0
else:
    p = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            p = min(p, (i * j % 2019))
            if not p:
                break
        if not p:
            break
print(p)

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