#include <iostream>
#include <algorithm>
using namespace std;

int N, S;
bool used[10];

int rec(int k, int r) {
  if(N > 10) return 0;
  if(k == N) return r == S;
  if(r > S) return 0;

  int res = 0;
  for(int i = 0; i < 10; ++i) {
    if(!used[i]) {
      used[i] = true;
      res += rec(k+1, r + (k+1)*i);
      used[i] = false;
    }
  }
  return res;
}

int main() {
  while(cin >> N >> S) {
    fill(used, used+10, false);
    cout << rec(0, 0) << endl;
  }
  return 0;
}