#include <iostream>
#include <string>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int memo[10][10];
bool used[10];
int N, S;

int dfs(int cnt, int sum) {
  int ret = 0;
  
  if(cnt == N+1) {
    return sum == S;
  }
  
  for(int i=0; i<10; i++) {
    if(used[i]) continue;
    used[i] = 1;
    ret += dfs(cnt + 1, sum + i*cnt);
    used[i] = 0;
  }
  
  return ret;
}

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