#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int a[MAXN], n, q;
long long sum[MAXN], jc[15];
int used[15], tmp[15];
void work(long long now, int lim) {
  for (int i = 0; i < lim; ++i) {
    used[i] = 1;
    tmp[i] = now / jc[lim - i - 1] + 1;
    now %= jc[lim - i - 1];
  }
  for (int i = 0; i < lim; ++i) {
    int sum = 0;
    for (int j = 0; j < lim; ++j) {
      sum += used[j];
      if (sum == tmp[i]) {
        tmp[i] = j + 1;
        used[j] = 0;
        break;
      }
    }
  }
  for (int i = n - lim + 1; i <= n; ++i) {
    a[i] = tmp[i - n + lim - 1] + n - lim;
  }
}
void init() {
  sum[1] = 1;
  jc[0] = 1;
  for (int i = 2; i <= n; ++i) sum[i] = sum[i - 1] + i;
  for (int i = 1; i <= 13; ++i) jc[i] = jc[i - 1] * i;
  for (int i = 1; i <= n; ++i) a[i] = i;
}
int main() {
  scanf("%d%d", &n, &q);
  init();
  long long now = 0;
  while (q--) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      long long res = 0;
      int l, r;
      scanf("%d%d", &l, &r);
      printf("%lld\n", sum[r] - sum[l - 1]);
    } else {
      int t;
      scanf("%d", &t);
      now += t;
      work(now, min(14, n));
      int i = n < 14 ? 1 : n - 13;
      for (i; i <= n; ++i) {
        sum[i] = sum[i - 1] + a[i];
      }
    }
  }
  return 0;
}
