#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};
using namespace std;
typedef long long  ll;

/** Problem0070 : Combination of Number Sequences **/
int tb[11][331];
int use[10];

void dfs(int d, int sum)
{
	tb[d-1][sum]++;
	rep(i, 10) {
		if (use[i]==0) {
			use[i]=1;
			dfs(d+1, sum+i*d);
			use[i]=0;
		}
	}
}

int main()
{
	int n, s;
	dfs(1, 0);
	while (cin>>n>>s) {
		if (s>330) {
			cout << 0 << endl;
		} else {
			cout << tb[n][s] << endl;
		}
	}
	return 0;
}