import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();

        long diff = b-a;

        if(diff >= 2019){
            System.out.println(0);
        }else{
            long min = Integer.MAX_VALUE;

            HashMap<Long,Integer> ab = new HashMap();
            for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            }

            ArrayList<Long> list = new ArrayList<>(ab.keySet());
            for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            }

            System.out.println(min);
        }
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();

        long diff = b-a;

        if(diff >= 2019){
            System.out.println(0);
        }else{
            long min = Integer.MAX_VALUE;

            HashMap<Long,Integer> ab = new HashMap();
            for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            }

            ArrayList<Long> list = new ArrayList<>(ab.keySet());
            for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            }

            System.out.println(min);
        }
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();

        long diff = b-a;

        if(diff >= 2019){
            System.out.println(0);
        }else{
            long min = Integer.MAX_VALUE;

            HashMap<Long,Integer> ab = new HashMap();
            for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            }

            ArrayList<Long> list = new ArrayList<>(ab.keySet());
            for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            }

            System.out.println(min);
        }
    } main {
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();

        long diff = b-a;

        if(diff >= 2019){
            System.out.println(0);
        }else{
            long min = Integer.MAX_VALUE;

            HashMap<Long,Integer> ab = new HashMap();
            for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            }

            ArrayList<Long> list = new ArrayList<>(ab.keySet());
            for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            }

            System.out.println(min);
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) long a = scan.nextLong(); a scan.nextLong() scan.nextLong scan long b = scan.nextLong(); b scan.nextLong() scan.nextLong scan long diff = b-a; diff b-a b a if(diff >= 2019){
            System.out.println(0);
        }else{
            long min = Integer.MAX_VALUE;

            HashMap<Long,Integer> ab = new HashMap();
            for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            }

            ArrayList<Long> list = new ArrayList<>(ab.keySet());
            for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            }

            System.out.println(min);
        } diff >= 2019 diff 2019 {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 {
            long min = Integer.MAX_VALUE;

            HashMap<Long,Integer> ab = new HashMap();
            for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            }

            ArrayList<Long> list = new ArrayList<>(ab.keySet());
            for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            }

            System.out.println(min);
        } long min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE HashMap<Long,Integer> ab = new HashMap(); ab new HashMap() for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            } long i = a; long i = a; i a i <= b i b i++ i++ i {
                ab.putIfAbsent(i % 2019,1);
            } {
                ab.putIfAbsent(i % 2019,1);
            } ab.putIfAbsent(i % 2019,1) ab.putIfAbsent ab i % 2019 i 2019 1 ArrayList<Long> list = new ArrayList<>(ab.keySet()); list new ArrayList<>(ab.keySet()) for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            } int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            } {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            } for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                } int j = i + 1; int j = i + 1; j i + 1 i 1 j < list.size() j list.size() list.size list j++ j++ j {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                } {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                } min = Math.min((list.get(i) * list.get(j)) % 2019, min) min Math.min((list.get(i) * list.get(j)) % 2019, min) Math.min Math (list.get(i) * list.get(j)) % 2019 (list.get(i) * list.get(j)) list.get(i) list.get list i list.get(j) list.get list j 2019 min System.out.println(min) System.out.println System.out System System.out min String[] args args
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();

        long diff = b-a;

        if(diff >= 2019){
            System.out.println(0);
        }else{
            long min = Integer.MAX_VALUE;

            HashMap<Long,Integer> ab = new HashMap();
            for (long i = a; i <= b; i++) {
                ab.putIfAbsent(i % 2019,1);
            }

            ArrayList<Long> list = new ArrayList<>(ab.keySet());
            for (int i = 0; i < list.size(); i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    min = Math.min((list.get(i) * list.get(j)) % 2019, min);
                }
            }

            System.out.println(min);
        }
    }
}