#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
using namespace std;
int main(){
	int n,s;
	while(cin>>n>>s){
		vi d(10);
		int co=0;
		rep(i,10)d[i]=i;
		do{
			do{
				int sum=0;
				rep(i,n)sum+=(i+1)*d[i];
				if(sum==s){
					co++;
				}
			}while(next_permutation(d.begin(),d.begin+n));
		}while(next_combination(d.begin(),d.begin()+n,d.end()));
		cout<<co<<endl;
	}
}