#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
mt19937 rnd(time(nullptr));
const int N = 2e5 + 5;
long long n, p[N], pref[N];
long long get(long long l, long long r) { return pref[r] - pref[l - 1]; }
void upd(long long first) {
  long long fact = 1;
  int s;
  for (long long i = n; i; --i) {
    fact *= (n - i + 1);
    if (fact >= first) {
      s = i;
      break;
    }
  }
  deque<int> a;
  for (long long i = s; i <= n; ++i) a.push_back(i);
  for (long long i = s; i <= n; ++i) {
    fact /= (n - i + 1);
    long long cnt = first / fact;
    if (first % fact == 0) {
      p[i] = a[cnt - 1];
      swap(a[0], a[cnt - 1]);
      a.pop_front();
      sort(a.begin(), a.end());
      for (int j = i + 1; j <= n; ++j) p[j] = a.back(), a.pop_back();
      break;
    }
    p[i] = a[cnt];
    swap(a[0], a[cnt]);
    a.pop_front();
    sort(a.begin(), a.end());
    first -= cnt * fact;
  }
  for (int i = s; i <= n; ++i) pref[i] = pref[i - 1] + p[i];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) p[i] = i, pref[i] = pref[i - 1] + i;
  long long ind = 1;
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      int l, r;
      cin >> l >> r;
      cout << get(l, r) << "\n";
    } else {
      long long first;
      cin >> first;
      ind += first;
      upd(ind);
    }
  }
}
