#include <cstdio>
#include <ctime>
#include <iostream>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

const int N = 1e5;
int a[N];

int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  while (q--) {                              
    int l, r, x;
    char ch;
    scanf(" %c%d%d", &ch, &l, &r), l--, r--;
    if (ch == 'Q') {
      long long sum = 0;
      while (l <= r)
        sum += a[l++];
      cout << sum << endl;
    } else {
      scanf("%d", &x);
      while (l <= r)
        a[l++] = x;
    }      
  }
  fprintf(stderr, "time = %.2f\n", 1. * clock() / CLOCKS_PER_SEC); // stamp
}