#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7, N = 2e5 + 5;
long long lt[20], Q, n, cnt, t, x, y, st, a[N];
bool vs[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> Q;
  cnt = 1;
  lt[0] = 1;
  for (int i = 1; i <= 16; i++) lt[i] = lt[i - 1] * i;
  st = max(1LL, n - 15);
  t, x, y;
  for (int i = 1; i <= n; i++) a[i] = a[i - 1] + i;
  while (Q--) {
    cin >> t >> x;
    if (t == 1) {
      cin >> y;
      cout << a[y] - a[x - 1] << '\n';
    } else {
      cnt += x;
      long long hav = cnt;
      for (int i = st; i <= n; i++) vs[i] = 0;
      for (int i = st; i < n; i++) {
        long long temp = 0;
        for (int j = st; j <= n; j++)
          if (!vs[j]) {
            temp += lt[n - i];
            if (temp >= hav) {
              hav -= temp - lt[n - i];
              a[i] = a[i - 1] + j;
              vs[j] = 1;
              break;
            }
          }
      }
      for (int i = st; i <= n; i++)
        if (!vs[i]) a[n] = a[n - 1] + i;
    }
  }
  return 0;
}
