import sys input = sys.stdin.readline class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & -i MM = 2*10**5 #segtree = SegTree([0]*MM,MM,0, lambda x,y:x+y) bit = Bit(MM+1) N, Q = map(int, input().split()) X = list(map(int, input().split())) R = [] for x in range(Q): s, a, b = input().split() a, b = int(a), int(b) if s == "A": R.append((a-1, 1, b, x)) else: R.append((a-1, 0, x)) R.append((b-1, 2, x)) R.sort(key=lambda x: (x[0], x[1])) cc = 0 YY = [0]*N ss = set() j = 0 B = [0]*N for i in range(N): while j < len(R): if R[j][1] == 1: # print(R[j]) # print(segtree.query(0, R[j][3])) B[R[j][0]] += (bit.sum(MM) - bit.sum(R[j][3]+1)) * R[j][2] # print(ss) j += 1 continue if R[j][0] > i: break if R[j][0] == i and R[j][1] == 2: break if R[j][1] == 0: cc += 1 bit.add(R[j][2]+1, 1) elif R[j][1] == 2: cc -= 1 bit.add(R[j][2]+1, -1) j += 1 YY[i] = cc #print(YY) for i in range(N): B[i] += YY[i]*X[i] print(*B)