#include <bits/stdc++.h>
using namespace std;
inline int read(void) {
  char ch = getchar();
  int ans = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) ans = ans * 10 + ch - '0', ch = getchar();
  return ans;
}
const int N = 2e5 + 7;
int n, m;
long long rk, prefix[N], fac[20];
void init(void) {
  rk = 0;
  for (int i = fac[0] = 1; i < 20; ++i) fac[i] = fac[i - 1] * i;
}
void solve(int x) {
  rk += x;
  long long tmp = rk;
  int len = 0;
  vector<int> v, ans;
  for (int i = 14; i >= 0; --i) {
    if (!len && tmp < fac[i]) continue;
    if (!len) {
      len = i + 1;
      for (int j = n - len + 1; j <= n; ++j) v.push_back(j);
    }
    int num = tmp / fac[i];
    tmp %= fac[i];
    ans.push_back(v[num]);
    v.erase(v.begin() + num);
  }
  for (int i = n - len + 1, j = 0; i <= n; ++i, ++j) {
    prefix[i] = prefix[i - 1] + ans[j];
  }
}
int main(void) {
  init();
  n = read(), m = read();
  for (int i = 1; i <= n; ++i) prefix[i] += prefix[i - 1] + i;
  for (int i = 1; i <= m; ++i) {
    int op = read();
    if (op == 1) {
      int l = read(), r = read();
      printf("%lld\n", prefix[r] - prefix[l - 1]);
    } else {
      int x;
      cin >> x;
      solve(x);
    }
  }
  return 0;
}
