#include #include #include #include #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) using namespace std; using namespace atcoder; using namespace __gnu_pbds; using ll=long long; using ld=long double; using vll=vector; using vvll=vector; using pll=pair; // using mint=modint; // template // using ordered_map=tree,rb_tree_tag,tree_order_statistics_node_update>; struct S{ ll sum=0,len=1; }; S op(S a,S b){ return {a.sum+b.sum,a.len+b.len}; } S e(){ return {0,0}; } using F=ll; S mapping(F f,S x){ return {x.sum+f*x.len,x.len}; } F composition(F f,F g){ return f+g; } F id(){ return 0; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N,Q; cin>>N>>Q; vll a(N),b(N,0); rep(i,0,N){ cin>>a[i]; } vectorinit(N); lazy_segtree seg(init); while(Q--){ string c; ll x,y; cin>>c>>x>>y; --x; if(c=="A"){ ll cnt=seg.get(x).sum; b[x]+=a[x]*cnt; seg.set(x,{0,1}); a[x]+=y; }else{ seg.apply(x,y,1); } } rep(x,0,N){ ll cnt=seg.get(x).sum; b[x]+=a[x]*cnt; } rep(i,0,N){ if(i)cout<<' '; cout<