#include <iostream>
#include <cstring>

using namespace std;

int retnum[11][10000];
bool isused[10];

void filling(int size, int depth, int sum){
     int tmp;
    
     //cout << "begin = " << begin << " depth = " << depth << " sum = " << sum << endl;
     if(size == depth-1){
	   retnum[size][sum]++;
	   return;
	 }
	 //cout << "retnum[" << depth << "][" << sum+begin*depth << "] = " << retnum[depth][sum+begin*depth] << endl;
     for(int i=0;i<=9;i++){
          if(!isused[i]){
               isused[i] = true;
               filling(size,depth+1,sum+i*depth);
               isused[i] = false;
          }
     }
}

int main(void){
    
     memset(retnum, 0, sizeof(retnum));
     memset(isused, false, sizeof(isused));

     for(int i=1;i<=10;i++){
          filling(i,1,0);
		  int tmp;
		  //cin >> tmp;
     }
    
     int n,m;
     while(cin >> n >> m){
          cout << retnum[n][m] << endl;
     }
}