#include using namespace std; template class FenwickTree { private: int n, mx; vector bit; public: FenwickTree(int sz) : n(sz + 1), mx(1), bit(n, 0) { while (mx * 2 <= n) mx *= 2; } FenwickTree(const vector &v) : n((int) v.size() + 1), mx(1), bit(n, 0) { for (int i = 0; i < n - 1; i++) add(i, v.at(i)); while (mx * 2 <= n) mx *= 2; } void add(int i, T x) { i++; while (i < n) bit.at(i) += x, i += i & -i; } void add(int l, int r, T x) { add(l, x); add(r + 1 , -x); } T sum(int i) { i++; T ret = 0; while (i > 0) ret += bit.at(i), i -= i & -i; return ret; } T sum(int l, int r) { return sum(r) - sum(l - 1); } int lower_bound(T w) { if (w <= 0) return 0; int x = 0; for (int k = mx; k > 0; k /= 2) { if (x + k <= n - 1 && bit.at(x + k) < w) { w -= bit.at(x + k); x += k; } } return x; } int upper_bound(T w) { if (w < 0) return 0; int x = 0; for (int k = mx; k > 0; k /= 2) { if (x + k <= n - 1 && bit.at(x + k) <= w) { w -= bit.at(x + k); x += k; } } return x; } }; 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) { if (c == 'A') { x--; ans.at(x) += (long) y * FT.sum(x); } else { x--, y--; FT.add(x, y, 1); } } for (int i = 0; i < N; i++) { ans.at(i) += (long) A.at(i) * FT.sum(i); } for (int i = 0; i < N; i++) { cout << ans.at(i) << ((i == N - 1) ? "\n" : " "); } }