#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999


int main(){
    int n,s;
    while(cin>>n>>s){
        static int dp[1<<10][400][10]={};
        dp[(1<<10)-1][0][0]=1;
        
        
        for(int i=1;i<=n;i++){
            for(int j=0;j<=s;j++){
                rep(k,10){
                    for(int l=(1<<10)-1;l>=0;l--){
                        if(j-(k*i)>=0 && (l&(1<<k))!=0){
                            dp[(l^(1<<k))][j][i] += dp[l][j-(k*i)][i-1];
                        }
                    }
                }
            }
        }
        
        
        int ans=0;
        rep(i,1<<10){
            ans += dp[i][s][n];
        }
        cout<<ans<<endl;
    }
}