#include using namespace std; #define REP(i,m,n) for(int i=(m); i<(int)(n); i++) #define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--) #define rep(i,n) REP(i,0,n) #define rrep(i,n) RREP(i,0,n) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define aut(r,v) __typeof(v) r = (v) #define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it) #define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it) #define fi first #define se second #define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);} template ostream& operator<<(ostream& o, const pair& p) {return o<<"("<string join(const vector&v, string del=", ") {stringstream s;rep(i,v.size())s<ostream& operator<<(ostream& o, const vector&v) {if(v.size())o<<"["<ostream& operator<<(ostream& o, const vector >&vv) {int l=vv.size();if(l){o<ostream& operator<<(ostream& o, const set& st) {vector v(st.begin(),st.end());o<<"{ "<ostream& operator<<(ostream& o, const map& m) {each(p,m){o<<(p==m.begin()?"{ ":",\n ")<<*p<<(p==--m.end()?" }":"");}return o;} inline void _debug(){cerr< void _debug(const First& first, const Rest&... rest){cerr< pii; typedef pair pll; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector vvl; const double PI = (1*acos(0.0)); const double EPS = 1e-9; const ll INF = 0x3f3f3f3f; const ll INFL = 0x3f3f3f3f3f3f3f3fLL; const ll mod = 1e9 + 7; inline void finput(string filename) { freopen(filename.c_str(), "r", stdin); } template struct BIT{ int N; vector dat; BIT(int n) : N(n), dat(n+1,0){ } void add(int i, T num){ for(int x = i+1; x <= N; x += (x & -x)) dat[x] += num; } T sum(int i){ T ret = 0; for(int x = i+1; x > 0; x -= (x & -x)) ret += dat[x]; return ret; } T sum(int i, int j){ return sum(j) - sum(i-1); } }; int main(){ ios_base::sync_with_stdio(0); // finput("./input"); int n,q; cin >> n >> q; vl A(n), B(n); rep(i,n) cin >> A[i]; vector> Q(q); rep(i,q){ char c; ll x, y; cin >> c >> x >> y; Q[i] = make_tuple(c,x,y); } BIT C(n+1); rrep(i,q){ char c = get<0>(Q[i]); ll x = get<1>(Q[i]), y = get<2>(Q[i]); if(c == 'A'){ x--; B[x] += C.sum(x) * y; }else{ x--; y--; C.add(x, 1); C.add(y+1, -1); } } rep(i,n) B[i] += C.sum(i) * A[i]; cout << join(B, " ") << endl; return 0; }