import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long min = Long.MAX_VALUE;
        int cnt = 0;
        if(r-l>=2018) {

            System.out.println(0);
            return;
        }
        for(long i = l; i<r; i++) {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        }
        System.out.println(min);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long min = Long.MAX_VALUE;
        int cnt = 0;
        if(r-l>=2018) {

            System.out.println(0);
            return;
        }
        for(long i = l; i<r; i++) {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        }
        System.out.println(min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long min = Long.MAX_VALUE;
        int cnt = 0;
        if(r-l>=2018) {

            System.out.println(0);
            return;
        }
        for(long i = l; i<r; i++) {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        }
        System.out.println(min);
    } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long min = Long.MAX_VALUE;
        int cnt = 0;
        if(r-l>=2018) {

            System.out.println(0);
            return;
        }
        for(long i = l; i<r; i++) {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        }
        System.out.println(min);
    } 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 min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE int cnt = 0; cnt 0 if(r-l>=2018) {

            System.out.println(0);
            return;
        } r-l>=2018 r-l r l 2018 {

            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; for(long i = l; i<r; i++) {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        } long i = l; long i = l; i l i<r i r i++ i++ i {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        } {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        } for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            } long j = i+1; long j = i+1; j i+1 i 1 j<=r j r j++ j++ j {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            } {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            } cnt++ cnt min = Math.min((i*j)%2019, min) min Math.min((i*j)%2019, min) Math.min Math (i*j)%2019 (i*j) i j 2019 min if(min==0) break; min==0 min 0 break; System.out.println(min) System.out.println System.out System System.out min String[] args args
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long min = Long.MAX_VALUE;
        int cnt = 0;
        if(r-l>=2018) {

            System.out.println(0);
            return;
        }
        for(long i = l; i<r; i++) {
            for(long j = i+1; j<=r; j++) {
                cnt++;
                //if(cnt>=2019) break;
                min = Math.min((i*j)%2019, min);
            }
            if(min==0) break;
        }
        System.out.println(min);
    }
}