import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

int n,s;
int saiki(int n1,int u,int m){
    if(n1 == s && m == n+1) return 1;
    else if(m==n+1)return 0;
    if(n1 > s) return 0;
    int ans;
    for(int i=0;i<10;i++){
	if(i+n1>s) break;
	if((u & (1<<i))==0){
	    ans += saiki(n1+m*i,u|(1<<i),m+1);
	}
    }
    return ans;
}

void main(){
    while(true){
	auto ss = readln();
	if(stdin.eof()) break;
	int[] s1 = ss.split().to!(int[]);
	n = s1[0];
	s = s1[1];
	writeln(saiki(0,0,1));
    }
}