#include #include using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, Q; cin >> N >> Q; vector A(N); for (int i = 0; i < N; i++) cin >> A[i]; vector B(N), count(N), check(N); for (int i = 0; i < Q; i++) { char c; cin >> c; int x, y; cin >> x >> y; if (c == 'A') { x--; B[x] += A[x] * (count[x] - check[x]); A[x] += y; check[x] = count[x]; } else { x--; y--; for (int j = x; j <= y; j++) count[j]++; } } for (int i = 0; i < N; i++) B[i] += A[i] * (count[i] - check[i]); cout << B.front(); for (int i = 1; i < N; i++) cout << " " << B[i]; cout << "\n"; }