import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} Main static String br = System.getProperty("line.separator"); br System.getProperty("line.separator") System.getProperty System "line.separator" static Scanner sc  = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    } main {

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    } Long L = nextLong(); L nextLong() nextLong Long R = nextLong(); R nextLong() nextLong Long min = 2019L; min 2019L for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        } Long i=L; Long i=L; i L i<=R i R i++ i++ i {
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        } {
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        } for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            } Long j=i+1L; Long j=i+1L; j i+1L i 1L j<=R j R j++ j++ j {
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            } {
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            } 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; if(min == 0) break; min == 0 min 0 break; println(min) println min String[] args args static int nextInt(){
        return Integer.parseInt(sc.next());
    } nextInt {
        return Integer.parseInt(sc.next());
    } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc static Long nextLong(){
        return Long.parseLong(sc.next());
    } nextLong {
        return Long.parseLong(sc.next());
    } return Long.parseLong(sc.next()); Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    } println {
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.println(o) out.println out o out.flush() out.flush out Object o o static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    } print {
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) out.print(o) out.print out o out.flush() out.flush out Object o o public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
}
