import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long tmp = 2018;

        if(r-l >= 2019){
            tmp = 0;
        }else{
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        }
        System.out.println(tmp);
        }
    } import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long tmp = 2018;

        if(r-l >= 2019){
            tmp = 0;
        }else{
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        }
        System.out.println(tmp);
        }
    } Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long tmp = 2018;

        if(r-l >= 2019){
            tmp = 0;
        }else{
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        }
        System.out.println(tmp);
        } main {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long tmp = 2018;

        if(r-l >= 2019){
            tmp = 0;
        }else{
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        }
        System.out.println(tmp);
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long l = sc.nextLong(); l sc.nextLong() sc.nextLong sc long r = sc.nextLong(); r sc.nextLong() sc.nextLong sc long tmp = 2018; tmp 2018 if(r-l >= 2019){
            tmp = 0;
        }else{
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        } r-l >= 2019 r-l r l 2019 {
            tmp = 0;
        } tmp = 0 tmp 0 {
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        } for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            } long i = l; long i = l; i l i < r i r ++i ++i i {
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            } {
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            } for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                } long j = i+1; long j = i+1; j i+1 i 1 j <= r j r ++j ++j j {
                    tmp = Math.min(tmp,(i*j)%2019);
                } {
                    tmp = Math.min(tmp,(i*j)%2019);
                } tmp = Math.min(tmp,(i*j)%2019) tmp Math.min(tmp,(i*j)%2019) Math.min Math tmp (i*j)%2019 (i*j) i j 2019 System.out.println(tmp) System.out.println System.out System System.out tmp String[] args args
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        long tmp = 2018;

        if(r-l >= 2019){
            tmp = 0;
        }else{
            for(long i = l;i < r;++i){
                for(long j = i+1;j <= r;++j){
                    tmp = Math.min(tmp,(i*j)%2019);
                }
            }
            
        }
        System.out.println(tmp);
        }
    }
