#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int bit(int bits) {
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
  bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
  return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main(){
	int n,s,sum;
	vector<int> src;
	set<vector<int> > ret;
	while(cin >> n >> s ){
		ret.clear();
		for(int msk=1;msk<(1<<10);msk++){
			if(bit(msk) != n )continue;
			src.clear();
			for(int j=0;j<10;j++){
				if( msk & (1<<j) )src.push_back(j);
			}
			do{
				sum = 0;
				for(int i=0;i<n;i++){
					sum += (i+1)*src[i];
				}
				if(sum == s){
					ret.insert(src);
				}
			}while(next_permutation(src.begin(),src.end()));
		}
		cout << ret.size() << endl;
	}
}