#include <iostream>
#include <set>

using namespace std;

int solve(int n,int s,set<int> a){
	if(s<0) return 0;
  if(n==0){
  	if(s==0) return 1;
  	else return 0;
  }
  int ret = 0;
  for(int i=9;i>=0;--i){
  	if(a.find(i)!=a.end()) continue;
  	set<int> b = a;
  	b.insert(i);
    ret += solve(n-1,s-i*n,b);
  }
  return ret;
}

int main(void){
  int n,s;
  while(cin>>n>>s){
  	set<int> a;
    cout<<solve(n,s,a)<<endl;
  }
}