import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        long L =scn.nextLong();
        long R =scn.nextLong(); 
        R=Math.min(R,L+4038);
        long answer = 2018;
        for(long i=L;i<=R;i++){
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        }
        System.out.println(answer);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        long L =scn.nextLong();
        long R =scn.nextLong(); 
        R=Math.min(R,L+4038);
        long answer = 2018;
        for(long i=L;i<=R;i++){
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        }
        System.out.println(answer);
    }
} Main public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        long L =scn.nextLong();
        long R =scn.nextLong(); 
        R=Math.min(R,L+4038);
        long answer = 2018;
        for(long i=L;i<=R;i++){
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        }
        System.out.println(answer);
    } main {
        Scanner scn=new Scanner(System.in);
        long L =scn.nextLong();
        long R =scn.nextLong(); 
        R=Math.min(R,L+4038);
        long answer = 2018;
        for(long i=L;i<=R;i++){
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        }
        System.out.println(answer);
    } Scanner scn=new Scanner(System.in); scn new Scanner(System.in) long L =scn.nextLong(); L scn.nextLong() scn.nextLong scn long R =scn.nextLong(); R scn.nextLong() scn.nextLong scn R=Math.min(R,L+4038) R Math.min(R,L+4038) Math.min Math R L+4038 L 4038 long answer = 2018; answer 2018 for(long i=L;i<=R;i++){
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        } long i=L; long i=L; i L i<=R i R i++ i++ i {
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        } {
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        } for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            } long j=i+1; long j=i+1; j i+1 i 1 j<=R j R j++ j++ j {
                long x = i*j%2019;
                answer=Math.min(answer,x);
            } {
                long x = i*j%2019;
                answer=Math.min(answer,x);
            } long x = i*j%2019; x i*j%2019 i*j i j 2019 answer=Math.min(answer,x) answer Math.min(answer,x) Math.min Math answer x System.out.println(answer) System.out.println System.out System System.out answer String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        long L =scn.nextLong();
        long R =scn.nextLong(); 
        R=Math.min(R,L+4038);
        long answer = 2018;
        for(long i=L;i<=R;i++){
            for(long j=i+1;j<=R;j++){
                long x = i*j%2019;
                answer=Math.min(answer,x);
            }
        }
        System.out.println(answer);
    }
}