/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com)
 * Date: 2014.05.30
 * OK, 0.184 sec
 */

#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>

using namespace std;

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

#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif

typedef long long ll;

const int N = 1e5;
const int PN = 500;

ll sx[N + 1];
int pn, n, k, mem[2][N], *x = mem[0], *y = mem[1];

#pragma pack(4)
struct Part {
  int i, n, x;
  ll sum() { return x == -1 ? sx[i + n] - sx[i] : (ll)x * n; }
};

Part p[PN];

void calc_sum() {
  forn(i, n)
    sx[i + 1] = sx[i] + x[i];
}

void init() {
  pn = 0, p[pn++] = {0, n, -1};
  calc_sum();
}

void build() {
  n = 0;
  forn(i, pn)
    if (p[i].x == -1)
      memcpy(y + n, x + p[i].i, p[i].n * sizeof(x[0])), n += p[i].n;
    else
      forn(j, p[i].n)
        y[n++] = p[i].x;
  swap(x, y);
  init();
}

int split( int i ) {
  int j = 0;
  while (j < pn && i >= p[j].n)
    i -= p[j++].n;
  if (i) {
    for (int k = pn++; k > j; k--)
      p[k] = p[k - 1];
    p[j].n = i;
    p[++j].i += i, p[j].n -= i;
  }
  return j;
}

int main() {
  #define NAME "sum"
  assert(freopen(NAME ".in", "r", stdin));
  assert(freopen(NAME ".out", "w", stdout));

  scanf("%d%d ", &n, &k);
  init();
  while (k--) {
    char c = getchar();
    int l, r, x;
    scanf("%d%d ", &l, &r);
    l = split(--l), r = split(r);
    if (c == 'A') {
      scanf("%d ", &x);
      for (; l < r; l++)
        p[l].x = x;
    } else {
      ll sum = 0;
      for (; l < r; l++)
        sum += p[l].sum();
      printf(I64 "\n", sum);
    }
    if (pn >= PN - 2)
      build();
  }
  return 0;
}
