 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;
 
 const int MAX_N=10+2;
 int count1;
 int perm[MAX_N];
 bool used[MAX_N];
 int n,s,sum;
 
 void permutation1(int pos,int n,int sum)
 {
   if(sum>s) return;
   int b=9;
   int sum2=0;
   for(int i=n;i>pos;i--)
   {
     while(used[b]) b--; 
     sum2+=(i*b);
     //cout<<sum2<<endl;
             
   }
   if((s-sum)>sum2) return;
   //if(s>sum2) return;
   
   if(pos==n)
   {
     if(sum==s)
     { 
       count1++;
       //for(int i=0;i<n;i++) cout<<perm[i]<<" ";
       //cout<<endl;
     }
     return;          
   }     
   for(int i=0;i<=9;i++)
   {
     if(!used[i])
     {
       perm[pos]=i;
       used[i]=true;
       permutation1(pos+1,n,sum+i*(pos+1));
       used[i]=false;            
     }        
   }
   return;
 }
 
 int main()
 {
   while(cin>>n>>s)
   {
     //for(int i=0;i<=n;i++) perm[i]=i;
     //used[MAX_N]={false};
     int b=9;
     int sum_max=0;
     int sum_min=0;
     for(int i=n;i>=1;i--)
     {
       sum_max+=(b*i);
       sum_min+=(9-b)*i;
       b--;        
     }
     if(s>sum_max||s<sum_min) cout<<"0"<<endl;
     else
     {
       count1=0;
       sum=0;
       permutation1(0,n,0);
       cout<<count1<<endl;
     }
   }
   //while(1); 
   return 0;
 }

 
  