#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int n, s;
	std::bitset<10> b;
	std::vector<int> k;
	int counter = 0;
	int max_num_subset = pow(2, 10);

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif
#if INPUT_FROM_FILE
	while(ifs >> n >> s){
#else
	while(std::cin >> n >> s){
#endif
		counter = 0;
		for(int i = 0; i < max_num_subset; i++){
			b = std::bitset<10>(i);
			if(b.count() == n){
				k.clear();
				for(int j = 0; j < 10; j++){
					if(b.test(j)){
						k.push_back(j);
					}
				}

				do{
					int sum = 0;
					for(int j = 0; j < n; j++){
						sum += (j + 1) * k[j];
					}
					if(sum == s){ counter++; }
				} while(std::next_permutation(k.begin(), k.end()));
			}
		}
		std::cout << counter << std::endl;
	}

 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}
