#include<algorithm>
#include<iostream>
#include<vector>

int main()
{
	int n, s;
	while( std::cin >> n >> s )
	{
		int ans = 0;
		int set = ( 1 << n ) - 1;

		while( set < 1 << 10 )
		{
			std::vector<int> k;

			for( int j = 0; j != 10; ++j )
				if( set >> j & 1 )
					k.push_back( j );

			do
			{
				int sum = 0;
				for( int i = 0; i != n; ++i )
					sum += ( i + 1 ) * k[i];

				if( sum == s )
					++ans;
			}while( std::next_permutation( k.begin(), k.end() ) );
	
			int x = set & -set, y = set + x;
			set = ( ( set & ~y ) / x >> 1 ) | y;
		}

		std::cout << ans << std::endl;
	}

	return 0;
}