#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
typedef long long ll;
typedef long double ld;
const ll inf = 999999999999999999;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
ll gcm(ll i, ll j) {//?????§??¬?´???°
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}

//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, s;
bool b[10];
int dp[11][330][1024], h[11];
int solve(int i, int wa,int o) {
	if (i == n) {
		if (wa == s)
			return 1;
		return 0;
	}
	if (dp[i][wa][o] != -1)
		return dp[i][wa][o];
	int ans = 0;
	for (int j = 0; j < 10; j++) {
		if (b[j]) {
			b[j] = 0;
			ans += solve(i + 1, wa + (i + 1)*j, o | h[j]);
			b[j] = 1;
		}
	}
	return ans;
}
signed main() {
	while (cin >> n >> s) {
		if (s > 330) cout << 0 << endl;
		else {
			h[0] = 1;
			for (int i = 0; i < 10; i++) {
				b[i] = 1;
				if (i > 0)
					h[i] = h[i - 1] * 2;
			}
			for (int i = 0; i < 11; i++) {
				for (int j = 0; j < 330; j++) {
					for (int z = 0; z < 1024; z++)
						dp[i][j][z] = -1;
				}
			}
			cout << solve(0, 0, 0) << endl;
		}
	}
	//getchar(); getchar();
}