#include <iostream>
#include <vector>
#include <utility>
using namespace std;

typedef vector <bool> VB;
typedef pair <int, int> PII;
typedef vector <PII> VII;

int main( void )
{
	int n, s;
	while ( cin >> n >> s )
	{
		vector <VII> dp( n+1 );

		dp[0].push_back( make_pair( 0, 0 ) );

		for ( int i = 1; i <= n; i++ )
		{
			VII& now = dp[i-1];
			for ( VII::iterator it = now.begin(); it != now.end(); it++ )
			{
				for ( int j = 0; j < 10; j++ )
				{
					PII next = *it;
					if ( ( next.first & ( 1 << j ) ) == 0 )
					{
						next.first |= ( 1 << j );
						next.second += i * j;
						dp[i].push_back( next );
					}
				}
			}
		}

		int kotae = 0;
		for ( VII::iterator it = dp[n].begin(); it != dp[n].end(); it++ )
		{
			if ( (*it).second == s )
				kotae ++;
		}
		
		cout << kotae << endl;
	}

	return 0;
}