#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



int main() {

	static int dp[1<<10][500];
	
	dp[0][0] = 1;
	for_(s, 0, 1<<10) {
		bitset<10> bs(s);
		int n = bs.count();
		
		for_(i, 0, 10) {
			if (s>>i & 1) continue;
			
			int ns = s|1<<i;
			int add = (n+1)*i;
			for_(j, 0, 333) dp[ns][j+add] += dp[s][j];
		}
	}
	
	static int tb[15][500];
	
	for_(s, 0, 1<<10) {
		bitset<10> bs(s);
		int n = bs.count();
		
		for_(j, 0, 333) {
			tb[n][j] += dp[s][j];
		}
	}
	
	int n, s;
	while(cin>>n>>s) { cout << tb[n][s] << endl; }
	
	return 0;
}