import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final long l = sc.nextLong();
    final long r = sc.nextLong();
    //final List<Integer> list = new ArrayList<>();
    long min = 10000;
    long min2 = 10000;
    long hoge1 = 0;
    long hoge2 = 0;
    long ans = 0;

    long check = r - l + 1;
    if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    }
    


    



    





}
} import java.io.BufferedReader; BufferedReader java.io import java.io.*; io.* java import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Collections; Collections java.util import java.util.Arrays; Arrays java.util public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final long l = sc.nextLong();
    final long r = sc.nextLong();
    //final List<Integer> list = new ArrayList<>();
    long min = 10000;
    long min2 = 10000;
    long hoge1 = 0;
    long hoge2 = 0;
    long ans = 0;

    long check = r - l + 1;
    if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    }
    


    



    





}
} Main public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final long l = sc.nextLong();
    final long r = sc.nextLong();
    //final List<Integer> list = new ArrayList<>();
    long min = 10000;
    long min2 = 10000;
    long hoge1 = 0;
    long hoge2 = 0;
    long ans = 0;

    long check = r - l + 1;
    if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    }
    


    



    





} main {
    
    final Scanner sc = new Scanner(System.in);
    final long l = sc.nextLong();
    final long r = sc.nextLong();
    //final List<Integer> list = new ArrayList<>();
    long min = 10000;
    long min2 = 10000;
    long hoge1 = 0;
    long hoge2 = 0;
    long ans = 0;

    long check = r - l + 1;
    if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    }
    


    



    





} final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc final long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long min = 10000; min 10000 long min2 = 10000; min2 10000 long hoge1 = 0; hoge1 0 long hoge2 = 0; hoge2 0 long ans = 0; ans 0 long check = r - l + 1; check r - l + 1 r - l r l 1 if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    } check >= 2019 check 2019 {
        System.out.println(0);
    } System.out.println(0) System.out.println System.out System System.out 0 {
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    } for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        } long i = l ; long i = l ; i l i <= r i r i++ i++ i {
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        } {
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        } for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            } long j = i + 1; long j = i + 1; j i + 1 i 1 j <= r j r j++ j++ j {
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            } {
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            } hoge1 = i hoge1 i hoge2 = j hoge2 j hoge1 = hoge1 % 2019 hoge1 hoge1 % 2019 hoge1 2019 hoge2 = hoge2 % 2019 hoge2 hoge2 % 2019 hoge2 2019 ans = hoge1 * hoge2 ans hoge1 * hoge2 hoge1 hoge2 while(ans >= 2019){
                    ans = ans % 2019;
                } ans >= 2019 ans 2019 {
                    ans = ans % 2019;
                } ans = ans % 2019 ans ans % 2019 ans 2019 if(min >= ans){
                    min = ans;
                } min >= ans min ans {
                    min = ans;
                } min = ans min ans System.out.println(min) System.out.println System.out System System.out min final String[] args args public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final long l = sc.nextLong();
    final long r = sc.nextLong();
    //final List<Integer> list = new ArrayList<>();
    long min = 10000;
    long min2 = 10000;
    long hoge1 = 0;
    long hoge2 = 0;
    long ans = 0;

    long check = r - l + 1;
    if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    }
    


    



    





}
} public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final long l = sc.nextLong();
    final long r = sc.nextLong();
    //final List<Integer> list = new ArrayList<>();
    long min = 10000;
    long min2 = 10000;
    long hoge1 = 0;
    long hoge2 = 0;
    long ans = 0;

    long check = r - l + 1;
    if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    }
    


    



    





}
} Main
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final long l = sc.nextLong();
    final long r = sc.nextLong();
    //final List<Integer> list = new ArrayList<>();
    long min = 10000;
    long min2 = 10000;
    long hoge1 = 0;
    long hoge2 = 0;
    long ans = 0;

    long check = r - l + 1;
    if(check >= 2019){
        System.out.println(0);
    }else{
        for(long i = l ; i <= r ; i++){
            for(long j = i + 1; j <= r ; j++){
                hoge1 = i;
                hoge2 = j;
                hoge1 = hoge1 % 2019;
                hoge2 = hoge2 % 2019;

                ans = hoge1 * hoge2;

                while(ans >= 2019){
                    ans = ans % 2019;
                }
                if(min >= ans){
                    min = ans;
                }
            }
        }
        System.out.println(min);
    }
    


    



    





}
}