#include #define rep(i,n) for(int i = 0; i < (n); ++i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) using namespace std; typedef long long int ll; typedef pair P; #define yn {puts("YES");}else{puts("NO");} const int MAX_N = 300005; ll bit[MAX_N+1]; int nn = MAX_N; // 1-index void adds(int a, ll w){ for(int x = a; x <= nn; x += x & -x) bit[x] += w; } ll sums(int a){ // bit[1,a]の和を返す. ll ret = 0; for(int x = a; x > 0; x -= x & -x) ret += bit[x]; return ret; } int main() { ll n, q; cin >> n >> q; ll a[n + 1] = {}; srep(i,1,n+1)cin >> a[i]; char c[q]; ll x[q], y[q]; rep(i,q)cin >> c[i] >> x[i] >> y[i]; ll b[n+1] = {}; drep(i,q){ if(c[i] == 'A'){ b[x[i]] += y[i] * sums(x[i]); }else{ adds(x[i], 1); adds(y[i] + 1, -1); } } srep(i,1,n+1){ b[i] += sums(i) * a[i]; cout << b[i] << ' '; } cout << endl; return 0; }