#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vii;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 

int n,s;
ll ans;

int calcS(vi v){
	int sum=0;
	for(int i=1; i<=v.size(); i++){
		sum+=i*v[i-1];
	}
	return sum;
}

void calc(vi v,int m){
	if(v.size()==n){
		do{
			if(calcS(v)==s) ans++;
		}while(next_permutation(all(v)));
		return;
	}
	for(int i=m; i<=9; i++){
		vi u=v;
		u.pb(i);
		calc(u, i+1);
	}
}


int main(){
	while(cin>>n>>s){
		ans=0LL;
		vi v(0);
		calc(v,0);
		cout<<ans<<endl;
	}
}