#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define MOD 1000000007 //#define MOD 998244353 #define LINF (long long)4e18 #define jck 3.141592 #define PI acos(-1.0); const double EPS = 1e-10; using ll = long long; using Pi = pair; using Pl = pair; template struct BIT{ vector bit; BIT(int sz){ bit.resize(sz); } void add(int k, T x){ //k番目にxを加える for(int i = k; i < bit.size(); i |= i+1) bit[i] += x; } T sum(int k){ //[0,k)の区間の総和を求める T res = 0; for(int i = k-1; i >= 0; i = (i & (i+1))-1){ res += bit[i]; } return res; } }; int main(){ int N,Q; cin >> N >> Q; vector A(N); rep(i,N) cin >> A[i]; vector c(Q); vector x(Q),y(Q); rep(i,Q) cin >> c[i] >> x[i] >> y[i]; BIT bit(N+1); vector ans(N); for(int i = Q-1; i >= 0; i--){ x[i]--; if(c[i] == 'A'){ ans[x[i]] += (ll)y[i]*(bit.sum(x[i]+1)); } else{ bit.add(x[i],1); bit.add(y[i],-1); } } rep(i,N){ cout << ans[i]+(ll)A[i]*bit.sum(i+1) << " "; } cout << endl; }