#include #define ls(k) k << 1 #define rs(k) k << 1 | 1 #define fi first #define se second #define open(s1, s2) freopen(s1, "r", stdin), freopen(s2, "w", stdout); using namespace std; typedef __int128 __; typedef long double lb; typedef double db; typedef unsigned long long ull; typedef long long ll; bool Begin; inline ll read(){ ll x = 0, f = 1; char c = getchar(); while(c < '0' || c > '9'){ if(c == '-') f = -1; c = getchar(); } while(c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void write(ll x){ if(x < 0){ putchar('-'); x = -x; } if(x > 9) write(x / 10); putchar(x % 10 + '0'); } int N,Q; ll X[101010]; ll Y[101010]; ll mo=1000000007; void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>Q; while(Q--) { cin>>s>>x; if(s=="x") cin>>X[x]; else if(s=="y") cin>>Y[x]; else if(s=="a") { ll A=1,B=1; for(int i = 0; i <= x; ++i){ if(X[i]) (A += X[i]*B%mo*B)%=mo; if(Y[i]) B = (B*Y[i]+1)%mo; else B=1; } cout<