#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;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZ2MgZ2V0Y2hhcl91bmxvY2tlZAojZGVmaW5lIGZvKGksbikgZm9yKGk9MDtpPG47aSsrKQojZGVmaW5lIEZvKGksayxuKSBmb3IoaT1rO2s8bj9pPG46aT5uO2s8bj9pKz0xOmktPTEpCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgc2koeCkJc2NhbmYoIiVkIiwmeCkKI2RlZmluZSBzbCh4KQlzY2FuZigiJWxsZCIsJngpCiNkZWZpbmUgc3MocykJc2NhbmYoIiVzIixzKQojZGVmaW5lIHBpKHgpCXByaW50ZigiJWRcbiIseCkKI2RlZmluZSBwbCh4KQlwcmludGYoIiVsbGRcbiIseCkKI2RlZmluZSBwcyhzKQlwcmludGYoIiVzXG4iLHMpCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgbXAgbWFrZV9wYWlyCiNkZW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