#include <iostream>
#include <cstdio>
using namespace std;
 
short dp[11][1<<10][341];
short ans[11][341];
int main(){
    dp[0][0][0] = 1;
    for(int i = 0 ; i < 10 ; i++){
        for(int j = 0 ; j < (1<<10) ; j++){
            for(int c = 0 ; c < 331 ; c++){
                if(dp[i][j][c] == 0 ) continue;
                for(int k = 0 ; k < 10 ; k++){
                    if(!(j>>k&1)){
                        dp[i+1][j|(1<<k)][(i+1)*k+c] += dp[i][j][c];
                    }
                }
            }
        }
    }
    /*cout << dp[1][2][2] << endl;*/
    for(int i = 0 ; i < 11 ; i++){
        for(int j = 0 ; j < (1<<10) ; j++){
            for(int c = 0 ; c < 331 ; c++){
                ans[i][c] += dp[i][j][c];
            }
        }
    }
    int n,s;
     
    while(~scanf("%d%d",&n,&s)){
        if(n > 10 || s > 330){
            cout << 0 << endl;
        }else{
            cout << ans[n][s] << endl;
        }
    }
}