# import sys; input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**7) from collections import defaultdict INF = float("inf") def getlist(): return list(map(int, input().split())) class lazySegTree(object): # N:処理する区間の長さ def __init__(self, N): self.N = N self.LV = (N - 1).bit_length() self.N0 = 2 ** self.LV self.data = [0] * (2 * self.N0) self.lazy = [0] * (2 * self.N0) # 遅延伝播を行うindexを生成 def gindex(self, l, r): L = (l + self.N0) >> 1; R = (r + self.N0) >> 1 lc = 0 if l & 1 else (L & -L).bit_length() rc = 0 if r & 1 else (R & -R).bit_length() for i in range(self.LV): if rc <= i: yield R if L < R and lc <= i: yield L L >>= 1; R >>= 1 # 遅延伝搬処理 def propagates(self, *ids): for i in reversed(ids): v = self.lazy[i-1] if not v: continue self.lazy[2 * i - 1] += v; self.lazy[2 * i] += v self.data[2 * i - 1] += v; self.data[2 * i] += v self.lazy[i - 1] = 0 # 区間[l, r]にxを加算 def update(self, l, r, x): *ids, = self.gindex(l, r + 1) self.propagates(*ids) L = self.N0 + l; R = self.N0 + r + 1 while L < R: if R & 1: R -= 1 self.lazy[R - 1] += x; self.data[R - 1] += x if L & 1: self.lazy[L - 1] += x; self.data[L - 1] += x L += 1 L >>= 1; R >>= 1 for i in ids: self.data[i - 1] = min(self.data[2 * i - 1], self.data[2 * i]) # 区間[l, r]内の最小値を求める def query(self, l, r): self.propagates(*self.gindex(l, r + 1)) L = self.N0 + l; R = self.N0 + r + 1 s = INF while L < R: if R & 1: R -= 1 s = min(s, self.data[R - 1]) if L & 1: s = min(s, self.data[L - 1]) L += 1 L >>= 1; R >>= 1 return s #処理内容 def main(): N, Q = getlist() A = getlist() query = [] for i in range(Q): c, x, y = list(input().split()) x, y = int(x), int(y) if c == "A": c = 0 else: c = 1 if c == 0: x -= 1 else: x -= 1; y -= 1 query.append([c, x, y]) # print(query) B = [0] * N lSeg = lazySegTree(N) for i in range(Q - 1, -1, -1): c, x, y = query[i] if c == 0: B[x] += y * lSeg.query(x, x) else: lSeg.update(x, y, 1) for i in range(N): B[i] += A[i] * lSeg.query(i, i) print(*B) if __name__ == '__main__': main()