import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

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


} import java.util.Scanner; Scanner java.util public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

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


} Main public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    } debug {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    } boolean debug = false; debug false if (debug != false) {
            return;
        } debug != false debug false {
            return;
        } return; System.out.println(str) System.out.println System.out System System.out str String str str public static void main(String[] args) {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            }
        }
        System.out.println(temp);
    } main {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            }
        }
        System.out.println(temp);
    } long L; L long R; R long[][] xList; xList try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        } {
            L = sc.nextLong();
            R = sc.nextLong();
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) L = sc.nextLong() L sc.nextLong() sc.nextLong sc R = sc.nextLong() R sc.nextLong() sc.nextLong sc if((R - L) > 2019 ){
            System.out.println(0);
            return;
        } (R - L) > 2019 (R - L) R L 2019 {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; long temp = 2019; temp 2019 for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            }
        } long j=L; long j=L; j L j < R j R j++ j++ j {
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            }
        } {
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            }
        } for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            } long i = j+1; long i = j+1; i j+1 j 1 i < R+1 i R+1 R 1 i++ i++ i {
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            } {
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            } long k = (j* i)%2019; k (j* i)%2019 (j* i) j i 2019 if(temp > k){
                    temp = k;
                } temp > k temp k {
                    temp = k;
                } temp = k temp k if(temp == 0){
                    break;
                } temp == 0 temp 0 {
                    break;
                } break; System.out.println(temp) System.out.println System.out System System.out temp String[] args args public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

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


} public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

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


} Main
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

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


}
