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

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