#include using i32 = int_fast32_t; using i64 = int_fast64_t; using u32 = uint_fast32_t; using u64 = uint_fast64_t; using f64 = double; using f80 = long double; #define FOR(v, a, b) for(i64 v = (a); v < (b); ++v) #define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v) #define REP(v, n) FOR(v, 0, n) #define REPE(v, n) FORE(v, 0, n) #define REV(v, a, b) for(i64 v = (a); v >= (b); --v) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it) #define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it) #define EXIST(c,x) ((c).find(x) != (c).end()) #define fst first #define snd second #define UNIQ(v) (v).erase(unique(ALL(v)), (v).end()) #define bit(i) (1LL<<(i)) #ifdef DEBUG #include #else #define dump(...) ((void)0) #endif using namespace std; template void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost< istream& operator>>(istream &is, vector &v){for(auto &a : v) is >> a; return is;} template void puts_all(const T &value){std::cout << value << "\n";} template void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);} template bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);} template bool chmax(T &a, const U &b){return (a void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);} template auto make_vector(int n, int m, const T &value){return vector>(n, vector(m, value));} struct Init{ Init(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12); cerr << fixed << setprecision(12); } }init; template class DualSegmentTree{ using value_type = typename Monoid::value_type; private: const int depth, size, hsize; std::vector data; inline void propagate(int i){ if(i < hsize){ data[i << 1 | 0] = Monoid::op(data[i], data[i << 1 | 0]); data[i << 1 | 1] = Monoid::op(data[i], data[i << 1 | 1]); data[i] = Monoid::id(); } } inline void propagate_top_down(int i){ std::vector temp; while(i > 1){ i >>= 1; temp.push_back(i); } for(auto it = temp.rbegin(); it != temp.rend(); ++it) propagate(*it); } public: DualSegmentTree(int n): depth(n > 1 ? 32-__builtin_clz(n-1) + 1 : 1), size((1 << depth) - 1), hsize(size / 2 + 1), data(size + 1, Monoid::id()) {} inline void update(int l, int r, const value_type &x){ propagate_top_down(l + hsize); propagate_top_down(r + hsize); int L = l + hsize; int R = r + hsize; while(L < R){ if(R & 1) --R, data[R] = Monoid::op(x, data[R]); if(L & 1) data[L] = Monoid::op(x, data[L]), ++L; L >>= 1, R >>= 1; } } inline value_type get(int i){ propagate_top_down(i + hsize); return data[i + hsize]; } template inline void init_with_vector(const std::vector &a){ data.assign(size + 1, Monoid::id()); for(int i = 0; i < (int)a.size(); ++i) data[hsize + i] = a[i]; } template inline void init(const T &val){ init_with_vector(std::vector(hsize, val)); } auto debug(){ return data; } }; template struct SumMonoid{ using value_type = T; constexpr inline static value_type id(){return 0;} constexpr inline static value_type op(const value_type &a, const value_type &b){return a + b;} }; int main(){ int N, Q; while(cin >> N >> Q){ vector A(N); cin >> A; DualSegmentTree> seg(N); vector B(N); while(Q--){ char c; cin >> c; int x, y; cin >> x >> y; if(c == 'A'){ --x; B[x] += seg.get(x) * A[x]; seg.update(x, x+1, -seg.get(x)); A[x] += y; }else{ seg.update(x-1, y, 1); } } REP(i,N){ B[i] += seg.get(i) * A[i]; } join(cout, ALL(B)); } return 0; }