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

int n,s;
bool use[10];
int sum;

int rec(int time){
  if(time == n-1){
    if(s-sum >=0 && !use[s-sum])return 1;
    else{
      int tmp;
      for(int i=0;i<10;i++){
	if(!use[i])tmp = i;
      }
      if(sum+tmp<s)return -1;
      return 0;
    }
  }else{
    int cnt = 0;
    for(int i=9;i>=0;i--){
      if(!use[i]){
	use[i] = true;
	sum += (n-time)*i;
	if(sum<=s){
	  int tmp = rec(time+1);
	  if(tmp<0)return cnt;
	  cnt += rec(time+1);
	}
	sum -= (n-time)*i;
	use[i] = false;
      }
    }
    return cnt;
  }
}

int main(){
  while(cin >> n >> s){
    for(int i=0;i<10;i++)use[i] = false;
    sum = 0;
    cout << rec(0) << endl;
  }
}