#include <iostream>
#include <cstdio>
using namespace std;

int ans,n,s;
bool used[10];
int solve(int bairitu,int nowpoint){//??????????????¨?????????????????°
	if(nowpoint>=s) return 0;
	int i;
	if(bairitu==1){
		if(s-nowpoint<10) if(used[s-nowpoint]==false) ans++;
	}else{
		for(i=0;i<=9&&used[i]==false;i++){
			used[i]=true;
			solve(bairitu-1,nowpoint+i*bairitu);
			used[i]=false;
		}
	}
	return 0;
}

int main(){
	while(~scanf("%d %d",&n,&s)){
		solve(n,0);
		cout << ans << endl;
		ans=0;
	}
	return 0;
}