#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

long long int L, R;

long long int dp[70][70][2];

long long int MOD = 1000000007;

int b[70];

long long int p[70];

void calc_b(long long int X) {

	for (int i = 0; i < 70; i++) { b[i] = 0; }

	int q = 1;
	while (X > 0) {
		b[q] = X % 2;
		X /= 2;
		q++;
	}
}


void CALC(long long int X) {

	calc_b(X);

	for (int i = 0; i < 70; i++) {
		for (int j = 0; j < 70; j++) {
			for (int k = 0; k <= 1; k++) {
				dp[i][j][k] = 0;
			}
		}
	}

	dp[69][0][0] = 1;

	for (int i = 68; i >= 1; i--) {
		for (int flag = 0; flag <= 1; flag++) {
			int m;
			if (flag == 1) { m = 1; }
			else { m = b[i]; }

			for (int k = 0; k <= m; k++) {
				for (int num = 0; num < 70; num++) {
					dp[i][num + k][flag | (k < m)] += dp[i + 1][num][flag]; dp[i][num + k][flag | (k < m)] %= MOD;
				}
			}
		}
	}
}

int B[70];
long long int dpp[70][2];

int H;

void CALC2(long long int X, int M) {

	calc_b(X);

	for (int i = 0; i < 70; i++) {
		for (int j = 0; j < 70; j++) {
			for (int k = 0; k <= 1; k++) {
				dp[i][j][k] = 0;
			}
		}
	}

	

	for (int i = 0; i < 70; i++) {
		for (int k = 0; k <= 1; k++) {
			dpp[i][k] = 0;
		}
	}

	dpp[69][0] = 1;

	for (int i = 68; i >= M + 1; i--) {
		for (int flag = 0; flag <= 1; flag++) {
			int min_val = 0; 
			int max_val = b[i];
			if (flag == 1) { max_val = 1; }
			if (i > H) { max_val = 0; }
			if (B[i] == 1 && i>=M+2) { min_val = 1; }
			for (int m = min_val; m <= max_val; m++) {
				dpp[i][flag | (m < b[i])] += dpp[i + 1][flag]; dpp[i][flag | (m < b[i])] %= MOD;
			}
		}
	}

	dp[M + 1][0][1] = dpp[M+1][1];
	dp[M + 1][0][0] = dpp[M+1][0];

	//cout <<"dpp :" <<dpp[M + 1][1] << endl;
	//cout << "dpp :" <<dpp[M + 1][0] << endl;

	for (int i = M; i >= 1; i--) {
		for (int flag = 0; flag <= 1; flag++) {
			int m;
			if (flag == 1) { m = 1; }
			else { m = b[i]; }

			for (int k = 0; k <= m; k++) {
				for (int num = 0; num < 70; num++) {
					dp[i][num + k][flag | (k < m)] += dp[i + 1][num][flag]; dp[i][num + k][flag | (k < m)] %= MOD;
				}
			}
		}
	}
}




long long int C[70];

long long int D[70];

int main(void) {

	cin >> L >> R;

	//for (long long int L = 110; L <= 110; L++) {
	//	for (long long int R = 20020; R <= 20020; R++) {
	//		cout << "L= " << L << "  R= " << R <<"   ";

			p[0] = 1;

			for (int i = 1; i < 70; i++) {
				p[i] = p[i - 1] * 2; p[i] %= MOD;
			}

			long long int ans1 = 0;

			//========================//

			CALC(R);
			//cout << "R= " << bitset<10>(R) << endl;

			/*for (int j = 0; j < 15; j++) {
				cout << "dp[1][" << j << "][1]= " << dp[1][j][1] << endl;
			}*/

			for (int j = 0; j < 70; j++) {
				D[j] = (dp[1][j][0] + dp[1][j][1]) % MOD;
			}

			CALC(L - 1);

			for (int j = 0; j < 70; j++) {
				D[j] = (D[j] - (dp[1][j][0] + dp[1][j][1]) + MOD) % MOD;
			}

			/*for (int j = 0; j < 5; j++) {
				cout << "dp[1][" << j << "][0]= " << dp[1][j][0] << endl;
			}*/


			for (int num = 1; num < 70; num++) {
				//ans1 += (dp[1][num][0]*p[num-1])%MOD; ans1 %= MOD;
				//ans1 += (dp[1][num][1]*p[num-1])%MOD; ans1 %= MOD;
				ans1 += (D[num] * p[num - 1]) % MOD; ans1 %= MOD;

			}

			//cout << "ans1= " <<ans1 << endl;

			//=============================//

			long long int ans2 = 0;

			/*	CALC(L - 1);

				for (int num = 1; num < 70; num++) {
					ans2 += (dp[1][num][0] * p[num - 1]) % MOD; ans2 %= MOD;
					ans2 += (dp[1][num][1] * p[num - 1]) % MOD; ans2 %= MOD;
				}
				*/


			long long int X = L;
			int q = 1;
			while (X > 0) {
				B[q] = X % 2;
				X /= 2;
				q++;
			}

			/*for (int i = 10; i >= 1; i--) {
				cout << B[i];
			}cout << endl;
			*/

			H = 0;
			for (int i = 1; i < 70; i++) { if (B[i] == 1) { H = i; } }
			//cout << "H= " << H << endl;

			int cnt = 1;

			for (int i = H - 1; i >= 1; i--) {
				if (B[i] == 1) {
					cnt++;

					CALC2(R, i - 1);

					for (int j = 0; j < 70; j++) { C[j] = (dp[1][j][0] + dp[1][j][1]) % MOD; }

					//for (int j = 0; j <= 4; j++) { cout << "C[" << j << "]= " << C[j] << endl; }

					CALC2(L - 1, i - 1);
					for (int j = 0; j < 70; j++) {
						C[j] = (C[j] - (dp[1][j][0] + dp[1][j][1]) + MOD+MOD) % MOD;
					}

					//for (int j = 0; j <= 4; j++) {	cout << "C[" << j << "]= " << C[j] << endl;}

					for (int j = 0; j < 70; j++) {
						ans2 += (p[j] * C[j]) % MOD;
						ans2 %= MOD;
					}

				}
			}


			//cout << "ans2= " << ans2 << endl;

			//============================
			long long int ans = (ans1 - ans2+MOD)%MOD;

			cout << ans<<endl;




		/*	long long int ANS = 0;
			for (long long int x = L; x <= R; x++) {
				for (long long int y = x; y <= R; y++) {
					if ((y%x) == (y^x)) { ANS++; }
				}
			}

			cout << "     ANS= " << ANS << endl;*/
			//if (ans != ANS) { cout << "find ---------------------------" << endl; break; }
	//	}
	//}
	

	
	

	return 0;
}

Measured memory_bytes: 384