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[1024] d;
int saiki(int n1,int u,int m){
    d[u] = n1;
    if(n1 == s && m == 0) return 1;
    else if(m==0){
	return 0;
    }else if(n1 > s) return 0;
    int ans;
    for(int i=9;i>=0;i--){
	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];
	if(n <= 330)
	    writeln(saiki(0,0,n));
	else writeln(0);
    }
}