#include <iostream>
#include <cstdio>

using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
int calc(int len, int *a) {
	int sum = 0;
	rep(i,len) {
		sum += (i+1) * a[i];
	}
	return sum;
}
void select(int n, int s, int *a, int len, int &ret, bool (&f)[10]) {
	if(len == n) {
		if(calc(len,a) == s) ret++;
		return;
	}
	if(calc(len,a) > s) return;
	rep(i,10) {
		if(f[i]) {
			a[len] = i;
			f[i] = 0;
			select(n,s,a,len+1,ret,f);
			f[i] = 1;
		}
	}
}
int main() { 
	int n, s;
	while(cin >> n >> s) {
		int a[10];
		int ret = 0;
		bool f[10];
		rep(i,10) {
			f[i] = 1;
		}
		select(n,s,a,0,ret,f);
		cout << ret << endl;
	}
	return 0;
}