#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvl;
const int mod = 1000000007;
const int N = 3e5;
const int B = 31;
vi g[N];
int a[B][N], x[N];
ll dp[B][N], pls[B][N];
int agla[B][N];

vi fac(int x){
	vi ans ;
	while(x){
		// cout<<x<<" ";
		ans.pb(x%2);
		x /= 2;
	}
	x = ans.size();
	int i;
	Fo(i, x, B) ans.pb(0);
	return ans;
}
ll P[B];
int n;
ll solve(int bit, int S){
	int i;
	ll ans = 0;
	int span = S;
	// find all possible subarrays starting from ith position
	Fo(i, 1, n+1){
		span = S;
		int j = i + span - 1;
		j = min(j, n);
		int ni = i;
		if(a[bit][i] == 0) {
			//agla 1
			//since it is 0, we need to find the closest next one
			//and decrement the span by that much distance
			//and find the possible subarrays from that position
			int cum = agla[bit][i] - i + 0;
			span -= cum;
			if(span <= 0) continue;
			ni = agla[bit][i];
			j = ni + span - 1;
			j = min(j, n);
		}
		int len = j-ni+1;
		int corr = dp[bit][j] - dp[bit][ni-1];
		if (!pls[bit][ni]) corr = len - corr;
		ans += corr;
		if (ans >= mod) ans -= mod;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,k,j,A,b;
	cin>>n>>A>>b;
	fo(i, n) cin>>x[i+1];
	
	P[1] = 1;
	Fo(j, 2, B) P[j] = 2*P[j-1];
	//build a[i][j]
	Fo(i, 1, n+1){
		vi bin = fac(x[i]);
		Fo(j, 1, B) a[j][i] = bin[j-1];
	}
	Fo(i, 1, B){
		//ith bit
		pls[i][0] = 0;
		dp[i][0] = 0;
		int sahi = 0;
		Fo(j, 1, n+1){
			if(a[i][j]) sahi = 1-sahi;
			pls[i][j] = sahi;
		}
		Fo(j, 1, n+1) dp[i][j] = pls[i][j] + dp[i][j-1];
		agla[i][n+1] = mod;
		Fo(j, n, 0){
			if (a[i][j]) agla[i][j] = j;
			else agla[i][j] = agla[i][j+1];
		}
	}
	ll ans = 0;
	//query for subarray length <= b
	Fo(i, 1, B){
		ans += ( solve(i, b) * P[i] ) % mod;
		if (ans >= mod) ans -= mod;
	}
	//subtract ans for subarray length <= a-1
	Fo(i, 1, B){
		ans -= ( solve(i, A-1) * P[i] ) % mod;
		if (ans >= mod) ans -= mod;
		if (ans < 0) ans += mod;
	}
	cout<<ans<<endl;

	return 0;
} 