#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int modu = 1e9 + 7;
int n, q, m;
long long dp[20][1 << 16];
long long sum[maxn];
int main() {
  cin >> n >> q;
  m = min(n, 16);
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < m; ++i) dp[i][1 << i] = 1;
  for (int mask = 0; mask < (1 << m); ++mask)
    for (int i = 0; i < m; ++i)
      if (mask & (1 << i))
        for (int j = 0; j < m; ++j)
          if (i != j && (mask & (1 << j)))
            dp[i][mask] += dp[j][mask - (1 << i)];
  long long rank = 1;
  sum[0] = 0;
  for (int i = 1; i <= n; ++i) sum[i] = sum[i - 1] + i;
  while (q--) {
    int cmd;
    scanf("%d", &cmd);
    if (cmd == 1) {
      int l, r;
      scanf("%d%d", &l, &r);
      printf("%lld\n", sum[r] - sum[l - 1]);
    } else {
      long long x;
      scanf("%lld", &x);
      rank += x;
      long long tmp = rank;
      int mask = (1 << m) - 1;
      for (int i = n - m + 1; i <= n; ++i) {
        long long t = 0;
        for (int j = 0; j < m; ++j)
          if (mask & (1 << j)) {
            if (t + dp[j][mask] >= tmp) {
              sum[i] = sum[i - 1] + j + (n - m + 1);
              mask -= (1 << j);
              tmp -= t;
              break;
            } else
              t += dp[j][mask];
          }
      }
    }
  }
  return 0;
}
