import java.util.*;

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

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

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

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

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc int min = 2018; min 2018 if(r / 2019 - l / 2019 >= 1){
            System.out.println(0);
            return;
        } r / 2019 - l / 2019 >= 1 r / 2019 - l / 2019 r / 2019 r 2019 l / 2019 l 2019 1 {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; l %= 2019 l 2019 r %= 2019 r 2019 for(int i = l; i <= r; i++){
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        } int i = l; int i = l; i l i <= r i r i++ i++ i {
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        } {
            for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            }
        } for(int j = i + 1; j <= r; j++){
                min = Math.min(min, i * j % 2019);
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j <= r j r 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
import java.util.*;

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

    }
}