import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        }
    } import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        }
    } Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        } main {
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long L = sc.nextLong(); L sc.nextLong() sc.nextLong sc long R = sc.nextLong(); R sc.nextLong() sc.nextLong sc long res=2019; res 2019 long bai = L/2019; bai L/2019 L 2019 if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        } L%2019==0 || 2019*(bai+1)<=R L%2019==0 L%2019 L 2019 0 2019*(bai+1)<=R 2019*(bai+1) 2019 (bai+1) bai 1 R {
            res = 0;
        } res = 0 res 0 {
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        } for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%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++){
                    res = Math.min(res,(i*j)%2019);
                }
            } {
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            } for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%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 {
                    res = Math.min(res,(i*j)%2019);
                } {
                    res = Math.min(res,(i*j)%2019);
                } res = Math.min(res,(i*j)%2019) res Math.min(res,(i*j)%2019) Math.min Math res (i*j)%2019 (i*j) i j 2019 System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        }
    } public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        }
    } Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        }
    }