#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( void )
{
	int n, s;
	while ( cin >> n >> s )
	{
		int answer = 0;
		for ( int i = 0; i < 1<<10; i++ )
		{
			int count = 0;
			for ( int j = 0; j < 10; j++ )
			{
				if ( i & 1 << j ) count++;
			}
			if ( count != n ) continue;
			vector <int> k;
			for ( int j = 0; j < 10; j++ )
			{
				if ( i & 1 << j ) k.push_back( j );
			}

			vector <int> a(n);
			for ( int i = 0; i < n; i++ )
				a[i] = i+1;

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

	return 0;
}