#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
const int MOD = 1000000007;
#define sz(x) (ll)(x).size()
#define rd ({ll x; cin >> x; x; })
#define dbg(x) cerr << "[" #x "] " << (x) << "\n"
// #define errv(x) {cerr << "["#x"] ["; for (const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
// #define errvn(x, n) {cerr << "["#x"] ["; for (auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
// #define cerr if(0)cerr
#define xx first
#define yy second
mt19937 rnd(std::chrono::high_resolution_clock::now().time_since_epoch().count());
/*_________________________________________________________________________________________________________________________*/
struct FenwickTree {
vector<int> bit; // binary indexed tree
int n;
FenwickTree(int n)
{
this->n = n;
bit.assign(n, 0);
}
int sum(int r)
{
int ret = 0;
for (; r >= 0; r = (r & (r + 1)) - 1)
ret += bit[r];
return ret;
}
int sum(int l, int r)
{
return sum(r) - sum(l - 1);
}
void add(int idx, int delta)
{
for (; idx < n; idx = idx | (idx + 1))
bit[idx] += delta;
}
};
ll modpow(ll a, ll b)
{
ll res = 1;
while (b) {
if (b & 1) {
res = (res * a) % MOD;
}
a = (a * a) % MOD;
b >>= 1;
}
return res;
}
void Solve()
{
ll n, q;
cin >> n >> q;
vector<ll> arr(n);
for (ll i = 0; i < n; i++) {
cin >> arr[i];
}
ll mxPos = 2 + __lg(1000000);
// dbg(mxPos);
// cerr << (1 << mxPos) << '\n';
vector<FenwickTree> fen(mxPos, FenwickTree(n + 1));
for (ll i = 0; i < n; i++) {
for (int j = 0; j < mxPos; j++) {
if (arr[i] & (1 << j)) {
fen[j].add(i, 1);
}
}
}
while (q--) {
ll qt;
cin >> qt;
if (qt == 1) {
ll idx, x;
cin >> idx >> x;
idx--;
for (int j = 0; j < mxPos; j++) {
if (arr[idx] & (1 << j)) {
if (x & (1 << j))
fen[j].add(idx, -1);
} else {
if (x & (1 << j)) {
fen[j].add(idx, 1);
}
}
}
arr[idx] = x;
} else {
ll l, r;
cin >> l >> r;
l--, r--;
ll ans = 0;
for (int j = 0; j < mxPos; j++) {
if (fen[j].sum(l, r))
ans = (ans + (modpow(2, j + r - l)) % MOD) % MOD;
}
cout << ans << '\n';
}
}
}
int32_t main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) {
// cout << "Case #" << i << ": "; // cout << "Case " << i << ": ";
Solve();
}
return 0;
}
// Coded by Tahsin Arafat (@TahsinArafat)