import java.util.*;

public class Main {
    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        long l = sc.nextInt();
        long r = sc.nextInt();

//        int min =0;

//        if ((l<2019)&&(r<2019)){
//            min = Math.min(min)
//            System.out.println(l*(l+1)%2019);
//        }else if ((l<2019)&&(2019<=r)){
//            System.out.println(0);
//        }else if(l==2019){
//            System.out.println(0);
//        }else if ((2019<l)&&(r<=2019*2-1)){
//            System.out.println(l*(l+1)%2019);
//        }else if ((2019<l)&&(2019*2<=r)){
//            System.out.println(0);
//        }
         long min= l*(l+1)%2019;


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

        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        long l = sc.nextInt();
        long r = sc.nextInt();

//        int min =0;

//        if ((l<2019)&&(r<2019)){
//            min = Math.min(min)
//            System.out.println(l*(l+1)%2019);
//        }else if ((l<2019)&&(2019<=r)){
//            System.out.println(0);
//        }else if(l==2019){
//            System.out.println(0);
//        }else if ((2019<l)&&(r<=2019*2-1)){
//            System.out.println(l*(l+1)%2019);
//        }else if ((2019<l)&&(2019*2<=r)){
//            System.out.println(0);
//        }
         long min= l*(l+1)%2019;


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

        }
    }
} Main public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        long l = sc.nextInt();
        long r = sc.nextInt();

//        int min =0;

//        if ((l<2019)&&(r<2019)){
//            min = Math.min(min)
//            System.out.println(l*(l+1)%2019);
//        }else if ((l<2019)&&(2019<=r)){
//            System.out.println(0);
//        }else if(l==2019){
//            System.out.println(0);
//        }else if ((2019<l)&&(r<=2019*2-1)){
//            System.out.println(l*(l+1)%2019);
//        }else if ((2019<l)&&(2019*2<=r)){
//            System.out.println(0);
//        }
         long min= l*(l+1)%2019;


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

        }
    } main {

        Scanner sc = new Scanner(System.in);

        long l = sc.nextInt();
        long r = sc.nextInt();

//        int min =0;

//        if ((l<2019)&&(r<2019)){
//            min = Math.min(min)
//            System.out.println(l*(l+1)%2019);
//        }else if ((l<2019)&&(2019<=r)){
//            System.out.println(0);
//        }else if(l==2019){
//            System.out.println(0);
//        }else if ((2019<l)&&(r<=2019*2-1)){
//            System.out.println(l*(l+1)%2019);
//        }else if ((2019<l)&&(2019*2<=r)){
//            System.out.println(0);
//        }
         long min= l*(l+1)%2019;


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

        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextInt(); l sc.nextInt() sc.nextInt sc long r = sc.nextInt(); r sc.nextInt() sc.nextInt sc long min= l*(l+1)%2019; min l*(l+1)%2019 l*(l+1) l (l+1) l 1 2019 if ((l%2019==0) || (r%2019==0)){
            System.out.println(0);
        }else if ((l/2019)!=(r/2019)){
            System.out.println(0);
        }else if ((l/2019)==(r/2019)) {
            for (long i = l; i < r; i++) {
                for (long j = i + 1; j < r + 1; j++) {
                    min = Math.min(min, i * j % 2019);
                }
            }
            System.out.println(min);

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

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

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

        } for (long i = l; i < r; i++) {
                for (long j = i + 1; j < r + 1; j++) {
                    min = Math.min(min, 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++) {
                    min = Math.min(min, i * j % 2019);
                }
            } {
                for (long j = i + 1; j < r + 1; j++) {
                    min = Math.min(min, i * j % 2019);
                }
            } for (long j = i + 1; j < r + 1; j++) {
                    min = Math.min(min, 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 {
                    min = Math.min(min, i * j % 2019);
                } {
                    min = Math.min(min, i * j % 2019);
                } min = Math.min(min, i * j % 2019) min Math.min(min, i * j % 2019) Math.min Math min i * j % 2019 i * j i j 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 = sc.nextInt();
        long r = sc.nextInt();

//        int min =0;

//        if ((l<2019)&&(r<2019)){
//            min = Math.min(min)
//            System.out.println(l*(l+1)%2019);
//        }else if ((l<2019)&&(2019<=r)){
//            System.out.println(0);
//        }else if(l==2019){
//            System.out.println(0);
//        }else if ((2019<l)&&(r<=2019*2-1)){
//            System.out.println(l*(l+1)%2019);
//        }else if ((2019<l)&&(2019*2<=r)){
//            System.out.println(0);
//        }
         long min= l*(l+1)%2019;


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

        }
    }
} public class Main {
    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        long l = sc.nextInt();
        long r = sc.nextInt();

//        int min =0;

//        if ((l<2019)&&(r<2019)){
//            min = Math.min(min)
//            System.out.println(l*(l+1)%2019);
//        }else if ((l<2019)&&(2019<=r)){
//            System.out.println(0);
//        }else if(l==2019){
//            System.out.println(0);
//        }else if ((2019<l)&&(r<=2019*2-1)){
//            System.out.println(l*(l+1)%2019);
//        }else if ((2019<l)&&(2019*2<=r)){
//            System.out.println(0);
//        }
         long min= l*(l+1)%2019;


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

        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        long l = sc.nextInt();
        long r = sc.nextInt();

//        int min =0;

//        if ((l<2019)&&(r<2019)){
//            min = Math.min(min)
//            System.out.println(l*(l+1)%2019);
//        }else if ((l<2019)&&(2019<=r)){
//            System.out.println(0);
//        }else if(l==2019){
//            System.out.println(0);
//        }else if ((2019<l)&&(r<=2019*2-1)){
//            System.out.println(l*(l+1)%2019);
//        }else if ((2019<l)&&(2019*2<=r)){
//            System.out.println(0);
//        }
         long min= l*(l+1)%2019;


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

        }
    }
}
