#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<functional>
#include <memory.h>



using namespace std;

int num[10]={0,1,2,3,4,5,6,7,8,9};
int n,s;

int test(int k, int now, int sum[10]){
    if(now==10)return 0;
    if(k==n){
        int count = 0;
        
        do{
            int ans = 0;
            for(int i=0; i<n; i++)ans+=(i+1)*sum[i];
            if(ans==s)count++;
        }while(next_permutation(sum, sum+n));
        return count;
    }
    
    
    int sum1[10],sum2[10];
    memcpy(sum1, sum, 10);
    memcpy(sum2, sum, 10);
    sum1[k]=num[now];
    
    return test(k+1, now+1, sum1)+test(k, now+1, sum2);
    
    
}

int main(){
    
    while(cin>>n>>s){
        int sum[10]={0};
        cout<<test(0, 0, sum)<<endl;
    }
}

    