#include <iostream>
#include <algorithm>
using namespace std;

int n, s, ans;

void solve(int k, int sum, int bits){
	if( sum < 0 ) return ;
	
	if( k == n+1 ){
		if( sum == 0 ) ans++;
		return;
	}
	
	for(int i=0 ; i <= 9 ; i++ ){
		if( bits & (1 << i) ) continue;
		solve( k+1 , sum - i * k , bits | (1 << i) );
	}
}

int main(){
	while( cin >> n >> s ){
		int max_sum = 0;
		int f[10];
		for(int i=0 ; i < n ; i++ ){
			f[i] = 10-n+i;
		}
		for(int i=1 ; i <= n ; i++ ){
			max_sum += i * f[i-1];
		}
		
		if( s > max_sum ){
			cout << 0 << endl;
		}else if( s == max_sum ){
			cout << 1 << endl;
		}else{
			ans = 0;
			solve( 1 , s , 0 );
			cout << ans << endl;
		}
	}
}