#pragma GCC optimize ("O3") #pragma GCC target ("avx") #include using namespace std; using ll = long long; ll a[100001], b[100001], x[100001], y[100001]; int main(){ constexpr ll mod = 1e9 + 7; cin.tie(0); ios::sync_with_stdio(false); char c; ll n, q, i, v, puni = 0; cin >> n >> q; a[0] = b[0] = 1; for(ll p = 0; p < q; p++){ cin >> c; if(c == 'a'){ if(puni != 10000000){ for(ll j = puni; j < n; j++){ a[j + 1] = (x[j] * b[j] % mod * b[j] + a[j]) % mod; b[j + 1] = (y[j] * b[j] + 1) % mod; } puni = 10000000; } cin >> i; cout << a[i] << endl; }else{ cin >> i >> v; (c == 'x' ? x : y)[i] = v; puni = min(puni, i); } } }