#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int kaijou(int w)
{
	if(w==0)return 1;
	else return kaijou(w-1)*w;
}
int main()
{
	vector<int> vec;
	for(int i=0;i<10;i++)
	{
		vec.pb(i);
	}
	int n,s;
	int k7=kaijou(7);
	while(scanf("%d %d",&n,&s)!=EOF)
	{
		int ans=0;
		SORT(vec);
		int t=0;
		do
		{
			if(t!=k7){t++;continue;}
			int k=0;
			for(int i=0;i<n;i++)
			{
				k+=vec[i]*(i+1);
			}
			if(k==s)ans++;
			t=0;
		}while(next_permutation(vec.begin(),vec.end()));
		cout << ans << endl;
	}
	return 0;
}