import java.util.*; import java.io.*; public class Main { public static void main (String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int q = Integer.parseInt(first[1]); ArrayDeque stack = new ArrayDeque<>(); String[] second = br.readLine().split(" ", n); for (int i = 1; i <= n; i++) { stack.push(new Order('A', i, Integer.parseInt(second[i - 1]))); } for (int i = 0; i < q; i++) { String[] line = br.readLine().split(" ", 3); stack.push(new Order(line[0].charAt(0), Integer.parseInt(line[1]), Integer.parseInt(line[2]))); } BinaryIndexedTree bit = new BinaryIndexedTree(n + 2); long[] ans = new long[n + 1]; while (stack.size() > 0) { Order x = stack.pop(); if (x.type == 'A') { ans[x.left] += x.right * bit.getSum(x.left); } else { bit.add(x.left, 1); bit.add(x.right + 1, -1); } } StringBuilder sb = new StringBuilder(); for (int i = 1; i <= n; i++) { if (i > 1) { sb.append(" "); } sb.append(ans[i]); } System.out.println(sb); } static class Order { char type; int left; int right; public Order(char type, int left, int right) { this.type = type; this.left = left; this.right = right; } } } class BinaryIndexedTree { int size; long[] tree; public BinaryIndexedTree(int size) { this.size = size; tree = new long[size]; } public void add(int idx, int value) { int mask = 1; while (idx < size) { if ((idx & mask) != 0) { tree[idx] += value; idx += mask; } mask <<= 1; } } public long get(int idx) { return getSum(idx) - getSum(idx - 1); } public long getSum(int from, int to) { return getSum(to) - getSum(from - 1); } public long getSum(int x) { int mask = 1; long ans = 0; while (x > 0) { if ((x & mask) != 0) { ans += tree[x]; x -= mask; } mask <<= 1; } return ans; } }