#include using namespace std; template class FenwickTree { private: int n; vector bit; public: FenwickTree(int sz) : n(sz + 1), bit(n, 0) {} void add(int i, T x) { i++; while (i < n) bit.at(i) += x, i += i & -i; } T sum(int i) { i++; T ret = 0; while (i > 0) ret += bit.at(i), i -= i & -i; return ret; } }; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, Q; cin >> N >> Q; vector A(N); for (int i = 0; i < N; i++) cin >> A.at(i); vector> V(Q); for (int i = 0; i < Q; i++) { char c; int x, y; cin >> c >> x >> y; V.at(i) = {c, x, y}; } reverse(V.begin(), V.end()); vector ans(N); FenwickTree FT(N); for (auto [c, x, y] : V) { x--; if (c == 'A') ans.at(x) += (long) y * FT.sum(x); else FT.add(x, 1), FT.add(y, -1); } for (int i = 0; i < N; i++) { cout << ans.at(i) + (long) A.at(i) * FT.sum(i) << ((i == N - 1) ? "\n" : " "); } }