import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) class fenwick_tree(object): def __init__(self, n): self.n = n self.log = n.bit_length() self.data = [0] * n def __sum(self, r): s = 0 while r > 0: s += self.data[r - 1] r -= r & -r return s def add(self, p, x): """ a[p] += xを行う""" p += 1 while p <= self.n: self.data[p - 1] += x p += p & -p def sum(self, l, r): """a[l] + a[l+1] + .. + a[r-1]を返す""" return self.__sum(r) - self.__sum(l) def lower_bound(self, x): """a[0] + a[1] + .. a[i] >= x となる最小のiを返す""" if x <= 0: return -1 i = 0 k = 1 << self.log while k: if i + k <= self.n and self.data[i + k - 1] < x: x -= self.data[i + k - 1] i += k k >>= 1 return i N, Q = map(int, input().split()) A = tuple(map(int, input().split())) query = [input().split() for _ in range(Q)] bit = fenwick_tree(N + 1) for x, s, t in query: if x == "B": bit.add(int(s)-1, 1) bit.add(int(t), -1) ans = [0] * N imoz = [0] * (N + 1) for x, s, t in query: s = int(s) t = int(t) if x == "A": ans[s - 1] += t * bit.sum(0, s) else: imoz[s - 1] += 1 imoz[t] -= 1 bit.add(s - 1, -1) bit.add(t, 1) for i in range(N): ans[i] += A[i] * imoz[i] imoz[i + 1] += imoz[i] print(*ans)