#include<iostream>
#include<bitset>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;

bitset<64> L, R;
ll memo[60][2][2][2];

ll dfs(int pos, int flagX, int flagY, int flagZ) {
    if (pos == -1) return 1;
    if (memo[pos][flagX][flagY][flagZ] != -1) {
        return memo[pos][flagX][flagY][flagZ];
    }
    ll ret = 0;
    if (flagX || L[pos] == 0) {
        ret = (ret + dfs(pos - 1, flagX, (R[pos] == 1 ? 1 : flagY), flagZ)) % MOD;
    }
    if ((flagX || L[pos] == 0) && (flagY || R[pos] == 1) && flagZ) {
        ret = (ret + dfs(pos - 1, flagX, flagY, flagZ)) % MOD;
    }
    if (flagY || R[pos] == 1) {
        ret = (ret + dfs(pos - 1, (L[pos] == 0 ? 1 : flagX), flagY, 1)) % MOD;
    }
    return memo[pos][flagX][flagY][flagZ] = ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll l, r;
    cin >> l >> r;
    L = bitset<64>(l);
    R = bitset<64>(r);
    for (int i = 0; i < 60; ++i) {
        for (int j = 0; j < 2; ++j) {
            for (int k = 0; k < 2; ++k) {
                for (int l = 0; l < 2; ++l) {
                    memo[i][j][k][l] = -1;
                }
            }
        }
    }
    cout << dfs(59, 0, 0, 0) << endl;
    return 0;
}