import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.List;

public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int l=sc.nextInt();
        int r=sc.nextInt();
        long max=Long.MAX_VALUE;
        for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        }
        System.out.println(max);

    }

}
 import java.awt.*; awt.* java import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java import java.util.List; List java.util public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int l=sc.nextInt();
        int r=sc.nextInt();
        long max=Long.MAX_VALUE;
        for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        }
        System.out.println(max);

    }

} Main public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int l=sc.nextInt();
        int r=sc.nextInt();
        long max=Long.MAX_VALUE;
        for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        }
        System.out.println(max);

    } main {
        Scanner sc = new Scanner(System.in);
        int l=sc.nextInt();
        int r=sc.nextInt();
        long max=Long.MAX_VALUE;
        for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        }
        System.out.println(max);

    } 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 long max=Long.MAX_VALUE; max Long.MAX_VALUE Long Long.MAX_VALUE for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        } int i=l; int i=l; i l i<r i r i++ i++ i {
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        } {
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        } long ii=i; ii i for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            } int j=i+1; int j=i+1; j i+1 i 1 j<=r j r j++ j++ j {
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            } {
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            } long jj=j; jj j long x=(ii*jj)%2019; x (ii*jj)%2019 (ii*jj) ii jj 2019 if (x<max){
                    max=x;
                } x<max x max {
                    max=x;
                } max=x max x if (max==0)break; max==0 max 0 break; if (max==0)break; max==0 max 0 break; System.out.println(max) System.out.println System.out System System.out max String args[] args public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int l=sc.nextInt();
        int r=sc.nextInt();
        long max=Long.MAX_VALUE;
        for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        }
        System.out.println(max);

    }

} public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int l=sc.nextInt();
        int r=sc.nextInt();
        long max=Long.MAX_VALUE;
        for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        }
        System.out.println(max);

    }

} Main
import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.List;

public class Main {
    public static void main(String args[]) throws IOException {
        Scanner sc = new Scanner(System.in);
        int l=sc.nextInt();
        int r=sc.nextInt();
        long max=Long.MAX_VALUE;
        for (int i=l;i<r;i++){
            long ii=i;
            for (int j=i+1;j<=r;j++){
                long jj=j;
                long x=(ii*jj)%2019;
                if (x<max){
                    max=x;
                }
                if (max==0)break;
            }
            if (max==0)break;
        }
        System.out.println(max);

    }

}

