#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef vector <int> VI;
int main( void )
{
	int n, s;

	while ( cin >> n >> s )
	{
		VI masks;
		for ( int i = 0; i < 1 << 10; i++ )
		{
			int cnt = 0;
			for ( int j = 0; j < 10; j++ )
			{
				if ( i & 1 << j ) cnt++;
			}
			if ( cnt == n ) masks.push_back( i );
		}

		int answer = 0;
		for ( VI::iterator it = masks.begin(); it != masks.end(); it++ )
		{
			int& mask = *it;
			
			VI k;
			for ( int i = 0; i < 10; i++ )
			{
				if ( mask & 1 << i ) k.push_back( i );
			}

			VI a(n);
			for ( int i = 0; i < n; i++ )
			{
				a[i] = i+1;
			}

			do {
				int sum = 0;
				for ( int i = n-1; i >= 0; i-- )
				{
					sum += a[i] * k[i];
					if ( sum > s ) break;
				}
				if ( sum == s ) answer++;
			} while ( next_permutation( a.begin(), a.end() ) );
		}

		cout << answer << endl;
	}

	return 0;
}