#include <iostream>
using namespace std;

const int maxN = 10;
const int limitS = 330;
const int gPNT = 1 << 10;
const int IO = limitS + 1;
const int IOO = gPNT * ( limitS + 1 );

int tb[ ( maxN+1 ) * ( gPNT ) * ( limitS+1 ) ];

int calc( int n, int pmt, int s ){
	int ans = 0;
	if ( s < 0 || s > limitS || n > maxN ) return 0;
	if ( tb[ n * IOO + pmt * IO + s ] >= 0 ){
		return tb[ n * IOO + pmt * IO + s ];
	}
	if ( n == 1 ){
		if ( s <= 9 && ( !( pmt & ( 1 << s ) ) ) ){
			ans = 1;
		}
	}else{
		for ( int i = 0; i < 10; ++i ){
			if ( !( ( 1 << i ) & pmt ) ){
				ans += calc( n-1, pmt+( 1 << i ), s - i*n );
			}
		}
	}
	tb[ n * IOO + pmt * IO + s ] = ans;
	return ans;
}

int main(){
	int n, s;

	for ( int i = 0; i < ( maxN+1 ) * ( gPNT ) * ( limitS+1 ); ++i ){
		tb[ i ] = -1;
	}

	while ( cin >> n >> s ){
		cout << calc( n, 0, s ) << endl;
	}

	return 0;
}