#include <bits/stdc++.h>
const long long oo = 1e15;
using namespace std;
int n, q, b[200010], f[200010];
long long sh = 1, gt[200010], a[200010];
void update(long long m) {
  int nm = lower_bound(gt + 1, gt + 16, m) - gt;
  for (int i = 1; i <= nm; i++) f[i] = i - 1;
  m--;
  for (int i = 1; i <= nm; i++) {
    int j;
    for (j = nm; j >= 1; j--)
      if (f[j] * gt[nm - i] <= m) break;
    b[i] = j;
    m -= f[j] * gt[nm - i];
    f[j] = nm + 1;
    for (int p = j + 1; p <= nm; p++) f[p]--;
  }
  for (int i = 1; i <= nm; i++)
    a[i + n - nm] = a[i + n - nm - 1] + b[i] + n - nm;
}
int main() {
  gt[0] = 1;
  for (int i = 1; i <= 15; i++) gt[i] = gt[i - 1] * i;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) a[i] = a[i - 1] + i;
  while (q--) {
    int tv;
    cin >> tv;
    if (tv == 1) {
      int l, r;
      cin >> l >> r;
      cout << a[r] - a[l - 1] << '\n';
    } else {
      int x;
      cin >> x;
      sh += x;
      update(sh);
    }
  }
  return 0;
}
