#include <bitset>
#include <iostream>
using namespace std;
using lint = long long;
const int MOD = 1000000007;

int getCountOfPair(bitset<64> l, bitset<64> r) {
    bool flag = false, diff = false, both = false;
    int i = 63;
    lint count[3] = {1, 0, 1};
    do {
        flag |= l[i];
        diff |= l[i] != r[i];
    } while (!r[i--]);
    for (; i >= 0; i--) {
        count[1] = (count[1] * 3 + (count[0] * !l[i] + count[2] * r[i]) * diff) % MOD;
        count[0] = ((count[0] << (!l[i] * flag * diff)) + both * r[i]) % MOD;
        count[2] = ((count[2] << (r[i] * diff)) + both * !l[i]) % MOD;
        flag |= l[i];
        bool check = diff;
        diff |= l[i] != r[i];
        check ^= diff;
        both = (both * !l[i] * r[i]) | check;
    }
    return int((count[0] + count[1] + count[2] + both) % MOD);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int answer;
    lint l, r
    cin >> l >> r;
    answer = getCountOfPair(l, r);
    cout << answer;
    return 0;
}