'use strict'
function main(input) {
    const tmp = input.split(' ');
    const L = parseInt(tmp[0], 10);
    const R = parseInt(tmp[1], 10);

    const modNum = 19;
    if (R - L + 1 >= modNum) {
        console.log(0);
    } else {
        const Lmod = L % modNum;
        const Rmod = R % modNum;
        if (Lmod > Rmod) {
            console.log(0);
        } else {
            let minimum = Infinity;
            for (let i = Lmod; i < Rmod; i++) {
                for (let k = i + 1; k <= Rmod; k++) {
                    minimum = Math.min((i * k) % modNum, minimum);

                }
            }
            console.log(minimum);

        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));