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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define MP make_pair
#define all(s) (s).begin(), (s).end()
#define rev(s) (s).rbegin(), (s).rend()
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

int memo[1<<10][10][1000];

int dfs(int used, int n, int s){
	if(n == 0) return s == 0;
	if(memo[used][n][s] != -1) return memo[used][n][s];

	int cnt = 0;
	rep(i, 10){
		int num = 1<<i;
		if(used&num) continue;
		used |= num;
		cnt += dfs(used, n-1, s-i*n);
		used &= ~num;
	}
	return memo[used][n][s] = cnt;
}

int main(){
	memset(memo, -1, sizeof(memo));
	int n, s;
	while(cin >> n >> s){
		if(s > 1000) return 0;
		else cout << dfs(0, n, s) << endl;
	}

	return 0;
}