#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353, mxn = 2e5 + 5;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  long long a[n + 1], dp[16];
  a[0] = 0;
  for (long long i = 1; i <= n; i++) {
    a[i] = i;
    if (i) a[i] += a[i - 1];
  }
  dp[0] = 1;
  for (long long i = 1; i <= 15; i++) dp[i] = dp[i - 1] * i;
  long long tmp = 0;
  long long st = max((long long)1, n - 15);
  while (q--) {
    long long ty;
    cin >> ty;
    if (ty == 1) {
      long long l, r;
      cin >> l >> r;
      cout << a[r] - a[l - 1] << endl;
    } else {
      long long x;
      cin >> x;
      tmp += x;
      long long cur = tmp;
      bool vis[17] = {true};
      memset(vis, true, sizeof(vis));
      long long id = 1;
      for (long long i = st; i <= n; i++) {
        long long id = i - st;
        long long val = dp[n - i];
        for (long long j = st; j <= n; j++) {
          if (!vis[j - st]) continue;
          if (val > cur) {
            id = j - st;
            break;
          } else {
            cur -= val;
          }
        }
        a[i] = st + id;
        vis[id] = false;
      }
      for (long long i = st; i <= n; i++) {
        if (i) a[i] += a[i - 1];
      }
    }
  }
}
