import java.io.*;

class Main{
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String sb1 = br.readLine();
        String[] a = sb1.split(" ");
        long[] c = new long[a.length];
        long[] b = new long[a.length];
        long d  = 2019;
        for(int i = 0;i < a.length;i++){
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        }
        
        if(b[0] == b[1]){
            for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            }
            System.out.println(d);
        }  else {
            System.out.println(0);
        }
        
    }
} import java.io.*; io.* java class Main{
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String sb1 = br.readLine();
        String[] a = sb1.split(" ");
        long[] c = new long[a.length];
        long[] b = new long[a.length];
        long d  = 2019;
        for(int i = 0;i < a.length;i++){
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        }
        
        if(b[0] == b[1]){
            for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            }
            System.out.println(d);
        }  else {
            System.out.println(0);
        }
        
    }
} Main public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String sb1 = br.readLine();
        String[] a = sb1.split(" ");
        long[] c = new long[a.length];
        long[] b = new long[a.length];
        long d  = 2019;
        for(int i = 0;i < a.length;i++){
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        }
        
        if(b[0] == b[1]){
            for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            }
            System.out.println(d);
        }  else {
            System.out.println(0);
        }
        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String sb1 = br.readLine();
        String[] a = sb1.split(" ");
        long[] c = new long[a.length];
        long[] b = new long[a.length];
        long d  = 2019;
        for(int i = 0;i < a.length;i++){
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        }
        
        if(b[0] == b[1]){
            for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            }
            System.out.println(d);
        }  else {
            System.out.println(0);
        }
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String sb1 = br.readLine(); sb1 br.readLine() br.readLine br String[] a = sb1.split(" "); a sb1.split(" ") sb1.split sb1 " " long[] c = new long[a.length]; c new long[a.length] a.length a a.length long[] b = new long[a.length]; b new long[a.length] a.length a a.length long d  = 2019; d 2019 for(int i = 0;i < a.length;i++){
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        } {
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        } c[i] = Long.parseLong(a[i]) c[i] c i Long.parseLong(a[i]) Long.parseLong Long a[i] a i b[i] = c[i]/d b[i] b i c[i]/d c[i] c i d if(b[0] == b[1]){
            for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            }
            System.out.println(d);
        }  else {
            System.out.println(0);
        } b[0] == b[1] b[0] b 0 b[1] b 1 {
            for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            }
            System.out.println(d);
        } for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            } long i = c[0]; long i = c[0]; i c[0] c 0 i < c[1] i c[1] c 1 i++ i++ i {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            } {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            } for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                } long j = i+1; long j = i+1; j i+1 i 1 j <= c[1] j c[1] c 1 j++ j++ j {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                } {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                } long e = i % 2019; e i % 2019 i 2019 long f = j % 2019; f j % 2019 j 2019 long g = e * f; g e * f e f d = Math.min(d, g % 2019) d Math.min(d, g % 2019) Math.min Math d g % 2019 g 2019 System.out.println(d) System.out.println System.out System System.out d {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 String[] args args
import java.io.*;

class Main{
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String sb1 = br.readLine();
        String[] a = sb1.split(" ");
        long[] c = new long[a.length];
        long[] b = new long[a.length];
        long d  = 2019;
        for(int i = 0;i < a.length;i++){
            c[i] = Long.parseLong(a[i]);
            b[i] = c[i]/d;
        }
        
        if(b[0] == b[1]){
            for (long i = c[0]; i < c[1]; i++) {
                for (long j = i+1; j <= c[1]; j++) {
                    long e = i % 2019;
                    long f = j % 2019;
                    long g = e * f;
                    d = Math.min(d, g % 2019);
                }
            }
            System.out.println(d);
        }  else {
            System.out.println(0);
        }
        
    }
}