#include <iostream>
using namespace std;

const int maxN = 10;
const int limitS = 330;
const int gPNT = 1 << 10;

class DP{
public:
	DP(){
		for ( int i = 0; i < ( maxN+1 ) * ( gPNT ) * ( limitS+1 ); ++i ){
			tb[ i ] = -1;
		}
	}

	int calc( int n, int pmt, int s ){
		int ans = 0;
		if ( s < 0 || s > limitS || n > maxN ) return 0;
		if ( tb[ ( n+1 ) * ( pmt ) * ( s+1 ) ] >= 0 ){
			return tb[ ( n+1 ) * ( pmt ) * ( s+1 ) ];
		}
		if ( n == 1 ){
			if ( s <= 9 && ( !( pmt & ( 1 << s ) ) ) ){
				ans = 1;
			}
		}else{
			for ( int i = 0; i < 10; ++i ){
				if ( !( ( 1 << i ) & pmt ) ){
					ans += calc( n-1, pmt+( 1 << i ), s - i*n );
				}
				tb[ ( n+1 ) * ( pmt ) * ( s+1 ) ] = ans;
			}
		}
		return ans;
	}

private:
	int tb[ ( maxN+1 ) * ( gPNT ) * ( limitS+1 ) ];
};

int main(){
	int n, s;
	DP* dp = new DP;

	while ( cin >> n >> s ){
		cout << dp->calc( n, 1 << 10, s ) << endl;
	}

	delete dp;

	return 0;
}