#include int ri() { int n; scanf("%d", &n); return n; } struct BIT { int n; std::vector data; BIT (int n) : n(n), data(n + 1) {} void add(int i, int val) { for (i++; i <= n; i += i & -i) data[i] += val; } int sum(int i) { int res = 0; for (; i; i &= i - 1) res += data[i]; return res; } }; int main() { int n = ri(); int q = ri(); int a[n]; for (auto &i : a) i = ri(); struct Query { int type; int x; int y; }; Query qs[q]; for (auto &i : qs) { std::string tmp; std::cin >> tmp; i.type = tmp[0] == 'B'; i.x = ri() - 1; i.y = ri(); } std::reverse(qs, qs + q); BIT tree(n + 1); int64_t res[n]; memset(res, 0, sizeof(res)); for (auto i : qs) { if (i.type) { tree.add(i.x, 1); tree.add(i.y, -1); } else res[i.x] += (int64_t) i.y * tree.sum(i.x + 1); } for (int i = 0; i < n; i++) res[i] += (int64_t) a[i] * tree.sum(i + 1); bool first = true; for (auto i : res) { if (first) first = false; else printf(" "); printf("%" PRId64, i); } puts(""); return 0; }