#include<iostream>

int memo[12][1024];

void dfs( int d, int bit, int sum )
{
	++memo[d][sum];
	for( int i = 0; i != 10; ++i )
	{
		if( bit & ( 1 << i ) )
			dfs( d + 1, bit & ~( 1 << i ), sum + ( d + 1 ) * i );
	}

	return;
}

int main()
{
	int n, s;
	dfs( 0, ( 1 << 10 ) - 1, 0 );
	while( std::cin >> n >> s )
		std::cout << ( s > 1023 ? 0 : memo[n][s] ) << std::endl;

	return 0;
}