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

int n,s,cnt;
bool use[10];
int a[10];

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

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