#include <iostream>
using namespace std;

void calc( int n, int s, bool* list, int& cnt, int sum = 0 ){
	for ( int i = 0; i < 10; ++i ){
		if ( !list[ i ] ) continue;
		int sumc = sum;
		list[ i ] = false;
		sumc += i * n;
		if ( n == 1 ){
			if ( sumc == s ) ++cnt;
		}else{
			calc( n-1, s, list, cnt, sumc );
		}
		list[ i ] = true;
	}
}

int main(){
	int n, s, cnt;
	bool list[ 10 ];

	while ( cin >> n >> s ){
		cnt = 0;
		for ( int i = 0; i < 10; ++i ){
			list[ i ] = true;
		}
		calc( n, s, list, cnt );
		cout << cnt << endl;
	}
	return 0;
}