#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

const long long MOD = 1000000007;

void test(int L, int R) {
    int a = 0, b = 0, c = 0;
    for(int x = L; x <= R; ++x) {
        for(int y = x; y <= R; ++y) {
            bool f = false, g = false;
            if ((x ^ y) == y % x) {
                ++a;
                f = true;
            }
            if (2 * x > y && (x & ~y) == 0) {
                ++b;
                g = true;
                cerr << x << "," << y << endl;
            }
            if (f != g) {
                ++c;
            }
        }
    }
    cerr << a << "," << b << "," << c << endl;
}

int dp[100][2][2][2];

void solve(long long L, long long R){
    int res = 0;

    int t = 62;
    dp[t][1][1][1] = 1;

    for(int i = t; i > 0; --i) {
        int ls = (L >> (i - 1)) & 1, rs = (R >> (i - 1)) & 1;

        // 0, 0, 0
        dp[i - 1][0][0][0] += dp[i][0][0][0] * 3 % MOD;
        dp[i - 1][0][0][0] %= MOD;

        // 0, 0, 1
        // This case doesn't exist

        // 1, 0, 0
        dp[i - 1][1][0][0] += dp[i][1][0][0] * 1 % MOD;
        dp[i - 1][1][0][0] %= MOD;

        // 1, 0, 1
        // This case doesn't exist
        if (rs) {
            // 1, 0, 0
            dp[i - 1][1][0][0] += dp[i][1][0][0] * 1 % MOD;
            dp[i - 1][1][0][0] %= MOD;

            dp[i - 1][0][0][0] += dp[i][1][0][0] * 1 % MOD;
            dp[i - 1][0][0][0] %= MOD;
        }

        // 0, 1, 0
        dp[i - 1][0][1][0] += dp[i][0][1][0] * 1 % MOD;
        dp[i - 1][0][1][0] %= MOD;
        if (ls) {
            // 0, 1, 1
            dp[i - 1][0][1][0] += dp[i][0][1][1] * 1 % MOD;
            dp[i - 1][0][1][0] %= MOD;
        } else {
            // 0, 1, 0
            dp[i - 1][0][1][0] += dp[i][0][1][0] * 1 % MOD;
            dp[i - 1][0][1][0] %= MOD;

            dp[i - 1][0][0][0] += dp[i][0][1][0] * 1 % MOD;
            dp[i - 1][0][0][0] %= MOD;

            // 0, 1, 1
            dp[i - 1][0][1][1] += dp[i][0][1][1] * 1 % MOD;
            dp[i - 1][0][1][1] %= MOD;

            dp[i - 1][0][0][0] += dp[i][0][1][1] * 1 % MOD;
            dp[i - 1][0][0][0] %= MOD;
        }

        if (rs || !ls) {
            // 1, 1, 0
            dp[i - 1][1][1][0] += dp[i][1][1][0] * 1 % MOD;
            dp[i - 1][1][1][0] %= MOD;
        }

        if (rs && ls) {
            // 1, 1, 1
            dp[i - 1][1][1][0] += dp[i][1][1][1] * 1 % MOD;
            dp[i - 1][1][1][0] %= MOD;
        } else if (rs && !ls) {
            // 1, 1, 1
            dp[i - 1][0][1][1] += dp[i][1][1][1] * 1 % MOD;
            dp[i - 1][0][1][1] %= MOD;

            dp[i - 1][1][0][0] += dp[i][1][1][1] * 1 % MOD;
            dp[i - 1][1][0][0] %= MOD;

            // 1, 1, 0
            dp[i - 1][1][0][0] += dp[i][1][1][0] * 1 % MOD;
            dp[i - 1][1][0][0] %= MOD;

            dp[i - 1][0][1][0] += dp[i][1][1][0] * 1 % MOD;
            dp[i - 1][0][1][0] %= MOD;
        } else if (!rs && !ls) {
            // 1, 1, 1
            dp[i - 1][1][1][1] += dp[i][1][1][1] * 1 % MOD;
            dp[i - 1][1][1][1] %= MOD;

            // 1, 1, 0
        }
    }

    for(int i = 0; i < 2; ++i) for(int j = 0; j < 2; ++j)  {
                res = (res + dp[0][i][j][0]) % MOD;
            }

    cout << res << endl;
}

signed main(){
    long long L;
    scanf("%lld",&L);
    long long R;
    scanf("%lld",&R);
    solve(L, R);
    return 0;
}


Measured memory_bytes: 256