const MOD: usize = 1e9 as usize + 7;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let l: usize = sc.read();
    let r: usize = sc.read();

    let mut dp = [0; 1 << 3];
    dp[0] = 1;
    for i in (0..61).rev() {
        let bit = 1 << i;
        let mut next = [0; 1 << 3];
        next[0] = 1;
        for mask in 0..(1 << 3) {
            if dp[mask] == 0 {
                continue;
            }
            let is_left_over = mask & 1 != 0;
            let is_right_below = (mask >> 1) & 1 != 0;
            let is_started = (mask >> 2) & 1 != 0;

            if is_started {
                for left in 0..2 {
                    for right in 0..2 {
                        if left > right {
                            continue;
                        }
                        if !is_left_over && (l >> i) & 1 > left {
                            continue;
                        }
                        if !is_right_below && (r >> i) & 1 < right {
                            continue;
                        }

                        let left_over = if is_left_over || (l >> i) & 1 < left {
                            1
                        } else {
                            0
                        };
                        let right_below = if is_right_below || (r >> i) & 1 > right {
                            2
                        } else {
                            0
                        };
                        let started = 4;
                        let next_mask = left_over + right_below + started;
                        next[next_mask] += dp[mask];
                        next[next_mask] %= MOD;
                    }
                }
            } else {
                assert!(!is_left_over);
                assert!(!is_right_below);
                if bit + bit - 1 < l || bit > r {
                    continue;
                }
                let next_left_over = if bit > l { 1 } else { 0 };
                let next_right_below = if bit < ((r >> i) << i) { 2 } else { 0 };
                let next_started = 4;
                let next_mask = next_left_over + next_right_below + next_started;
                next[next_mask] = 1;
            }
        }
        dp = next;
    }
    println!("{}", (4..8).map(|i| dp[i]).sum::<usize>() % MOD);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352