using namespace std;
#include <iostream>
#include <fstream>
#define MAXN 100005
constexpr long long MOD = 1e9 + 7;
int N,M;
pair<long long,long long> st[262144];
pair<long long,long long> combine(pair<long long,long long> a,pair<long long,long long> b) {
// c(ax + b) + d = acx + (bc + d)
return make_pair((a.first * b.first) % MOD,((a.second * b.first) % MOD + b.second));
}
void update(int x,pair<long long,long long> v,int l,int r,int p) {
if(l > x || r < x) return;
if(l == r) {
st[p] = v;
return;
}
int m = (l + r) / 2;
update(x,v,l,m,2 * p + 1);
update(x,v,m + 1,r,2 * p + 2);
st[p] = combine(st[2 * p + 1],st[2 * p + 2]);
}
void update(int x,pair<char,long long> v) {
if(v.first == '+') {
update(x,make_pair(1,v.second),0,MAXN,0);
}else if(v.first == '-') {
update(x,make_pair(1,MOD - v.second),0,MAXN,0);
}else if(v.first == '*') {
update(x,make_pair(v.second,0),0,MAXN,0);
}
}
pair<long long,long long> getSum(int a,int b,int l,int r,int p) {
if(l > b || r < a) return make_pair(1,0);
if(l >= a && r <= b) return st[p];
int m = (l + r) / 2;
return combine(getSum(a,b,l,m,2 * p + 1),getSum(a,b,m + 1,r,2 * p + 2));
}
long long getSum(long long v,int x) {
pair<long long,long long> res = getSum(0,x,0,MAXN,0);
return ((v * res.first) % MOD + res.second) % MOD;
}
void init() {
for(int i = 0;i < MAXN;++i) {
update(i,make_pair('+',0));
}
}
string pp(pair<long long,long long> p) {
cout << p.first << " " << p.second << endl;
}
int main() {
init();
cin >> N >> M;
for(int i = 0;i < N;++i) {
char a;
int b;
cin >> a >> b;
update(i,make_pair(a,b));
}
for(int i = 0;i < M;++i) {
char a;
cin >> a;
if(a == 'c') {
long long b,c;
char d;
cin >> b >> c >> d;
update(b - 1,make_pair(d,c));
}else{
int b,c;
cin >> b >> c;
cout << getSum(b,c - 1) << endl;
}
}
return 0;
}
dXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPGZzdHJlYW0+CgojZGV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