#include <bits/stdc++.h>
using namespace std;
const int FACT_MAX = 14;
const int NMAX = 200000;
int n, q;
long long fact[20], sp[NMAX + 5];
int perm[NMAX + 5];
void kth_perm(long long k) {
  int mx = min(n, 14);
  vector<int> v(mx);
  iota(v.begin(), v.end(), n - mx + 1);
  int start = n - mx;
  for (int i = 1; i <= mx; i++) {
    long long poz;
    if (k == 0)
      poz = v.size();
    else {
      poz = k / fact[mx - i] + 1;
      if (k % fact[mx - i] == 0) poz--;
    }
    perm[start + i] = v[poz - 1];
    sp[start + i] = sp[start + i - 1] + (long long)perm[start + i];
    v.erase(v.begin() + poz - 1);
    k = k % fact[mx - i];
  }
}
int main() {
  long long crt_perm = 1;
  int tip, l, r, x;
  scanf("%d %d", &n, &q);
  fact[0] = 1;
  for (int i = 1; i <= FACT_MAX; i++) fact[i] = (long long)i * fact[i - 1];
  for (int i = 1; i <= n; i++) {
    perm[i] = i;
    sp[i] = sp[i - 1] + (long long)i;
  }
  for (int i = 1; i <= q; i++) {
    scanf("%d", &tip);
    if (tip == 1) {
      scanf("%d %d", &l, &r);
      printf("%lld\n", sp[r] - sp[l - 1]);
    } else {
      scanf("%d", &x);
      crt_perm += x;
      kth_perm(crt_perm);
    }
  }
  return 0;
}
