import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	long l = Long.parseLong(sc.next());
	long r = Long.parseLong(sc.next());
	long min = (l*r)%2019;
	if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	}
}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	long l = Long.parseLong(sc.next());
	long r = Long.parseLong(sc.next());
	long min = (l*r)%2019;
	if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	}
}
} Main public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	long l = Long.parseLong(sc.next());
	long r = Long.parseLong(sc.next());
	long min = (l*r)%2019;
	if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	}
} main {
	Scanner sc = new Scanner(System.in);
	long l = Long.parseLong(sc.next());
	long r = Long.parseLong(sc.next());
	long min = (l*r)%2019;
	if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	}
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = Long.parseLong(sc.next()); l Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc long r = Long.parseLong(sc.next()); r Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc long min = (l*r)%2019; min (l*r)%2019 (l*r) l r 2019 if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	} (r - l) >= 2018 (r - l) r l 2018 {
		System.out.println(0);
	} System.out.println(0) System.out.println System.out System System.out 0 {
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	} for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		} long i = l; long i = l; i l i < r i r i++ i++ i {
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		} {
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		} for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			} long j = i+1; long j = i+1; j i+1 i 1 j < r+1 j r+1 r 1 j++ j++ j {
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			} {
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			} if((j*i)%2019 < min){
					min = ((j*i)%2019);
				} (j*i)%2019 < min (j*i)%2019 (j*i) j i 2019 min {
					min = ((j*i)%2019);
				} min = ((j*i)%2019) min ((j*i)%2019) (j*i) j i 2019 System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	long l = Long.parseLong(sc.next());
	long r = Long.parseLong(sc.next());
	long min = (l*r)%2019;
	if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	}
}
} public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	long l = Long.parseLong(sc.next());
	long r = Long.parseLong(sc.next());
	long min = (l*r)%2019;
	if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	}
}
} Main
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	long l = Long.parseLong(sc.next());
	long r = Long.parseLong(sc.next());
	long min = (l*r)%2019;
	if((r - l) >= 2018){
		System.out.println(0);
	}else{
		for(long i = l; i < r; i++){
			for(long j = i+1; j < r+1; j++){
				if((j*i)%2019 < min){
					min = ((j*i)%2019);
				}
			}
		}
	System.out.println(min);
	}
}
}
