#include using namespace std; typedef long long ll; typedef pair P; #define DUMP(x) cout << #x << " = " << (x) << endl; #define FOR(i, m, n) for (ll i = m; i < n; i++) #define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) #define FOREACH(x, a) for (auto&(x) : (a)) #define ALL(v) (v).begin(), (v).end() #define SZ(x) ll(x.size()) // 1-indexed class BIT { public: vector bit; ll M; BIT(ll M) : bit(vector(M + 1, 0)), M(M) {} // a[1] + a[2] + ... + a[i]を求める ll sum(ll i) { if (i == 0) return 0; return bit[i] + sum(i - (i & -i)); } // a[i] += x void add(ll i, ll x) { if (i > M) return; bit[i] += x; add(i + (i & -i), x); } }; int main() { ll n, q; cin >> n >> q; vector a(n); REP(i, n) { cin >> a[i]; } // 1-indexed vector b(n + 1, 0); vector> sxy(q); REP(i, q) { string s; ll x, y; cin >> sxy[i].first >> sxy[i].second.first >> sxy[i].second.second; } BIT bit(n); IREP(i, q) { string s = sxy[i].first; ll x = sxy[i].second.first; ll y = sxy[i].second.second; if (s == "A") { b[x] += y * (bit.sum(x)); } else { bit.add(x, 1); if (y + 1 <= n) bit.add(y + 1, -1); } } REP(i, n) { b[i + 1] += a[i] * (bit.sum(i + 1)); } REP(i, n) { cout << b[i + 1] << " \n"[i == n - 1]; } }