from itertools import accumulate N,Q = map(int,input().split()) A = list(map(int,input().split())) CXY = [input().split() for _ in range(Q)] B = [0] * N C = [0] * (N + 1) for c,x,y in CXY: if c == "B": x, y = int(x), int(y) C[x - 1] += 1 C[y] -= 1 C = list(accumulate(C)) from atcoder.lazysegtree import LazySegTree def op(x, y): return [x[0] + y[0], x[1] + y[1]] e = [0, 0] def mapping(f, x): return [x[0] + f * x[1], x[1]] def composition(g, f): return g + f id = 0 base = [[0, 1] for _ in range(N)] LST = LazySegTree(op, e, mapping, composition, id, base) for c,x,y in CXY: x, y = int(x), int(y) if c == "B": LST.apply(x-1,y,1) else: B[x-1] += y * (C[x-1] - LST.get(x-1)[0]) for i in range(N): B[i] += A[i] * LST.get(i)[0] print(*B)