import std; const segSize = 1 << 20; int[segSize * 2] seg; void update(int l, int r, int v) { l += segSize; r += segSize; while (l < r) { if (l % 2 == 1) { seg[l] += v; l++; } l /= 2; if (r % 2 == 1) { seg[r - 1] += v; r--; } r /= 2; } } int get(int ind) { ind += segSize; int v = seg[ind]; while (true) { ind /= 2; // 上にのぼる if (ind == 0) break; v += seg[ind]; } return v; } alias Q = Tuple!(string, "c", int, "x", int, "y"); void main() { int n, q; scan(n, q); auto a = readints; Q[] qs; foreach (_; 0..q) { string c; int x, y; scan(c, x, y); qs ~= Q(c, x, y); } auto ans = new int[n + 1]; foreach_reverse (e; qs) { if (e.c == "A") { ans[e.x] += e.y * get(e.x); } if (e.c == "B") { update(e.x, e.y + 1, 1); } } foreach (i; 1..n+1) { ans[i] += a[i-1] * (get(i) + 0); } writeln(ans[1..$].map!text.join(' ')); } void scan(T...)(ref T a) { string[] ss = readln.split; foreach (i, t; T) a[i] = ss[i].to!t; } T read(T=string)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readints = reads!int;