#include<iostream>
#include<cstring>

using namespace std;

int table[10+1][330+1];

void numnum(int size, int depth, int memo[], int sum ){
	if (size + 1 == depth ) {
		table[size][sum]++;
	}else{
		for (int i = 0; i <= 9; ++i ){
			if( memo[i] == 0 ) {
				memo[i] = 1;
				numnum (size, depth + 1, memo, sum+i*depth );
				memo[i] = 0;
			} // end if
		} // end for
	} // end if
}

int main(){

	int n, s, memo[10];

	memset(table,0,sizeof(table ) );

	for (int i = 1; i <= 10; ++i ) {
		memset (memo, 0, sizeof (memo ) );
		numnum (i, 1, memo, 0 );
	} // end for

	while ( cin >> n >> s ) {
		cout << table[n][s] << endl;
	} // end while

	return 0;
}