import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){

        Long L = nextLong();
        Long R = nextLong();

        Long min = 2019L;
        for(Long i=L; i<=R; i++){
            for(Long j=i+1L; j<=R; j++){
                min = Math.min((i*j)%2019, min);
                if(min == 0) break;
            }
            if(min == 0) break;
        }

        println(min);
    }

    static int nextInt(){
        return Integer.parseInt(sc.next());
    }
    static Long nextLong(){
        return Long.parseLong(sc.next());
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz