#include<iostream>
#include<queue>
#include<cstring>

using namespace std;

typedef struct{
  char data[10];
  int rev;
  int sum;
}Num;

int dp[10][400];
int n,s;

void solve(){
  Num num;
  fill(num.data,num.data+10,1);
  queue <Num> Q;
  num.sum = num.rev = 0;
  Q.push(num);
  while(!Q.empty()){
    Num now = Q.front();
    Q.pop();
    if(now.rev)dp[now.rev][now.sum]++;
    for(int i = 0; i < 10; i++){
      if(now.data[i]){
	Num next = now;
	next.data[i] =  0;
	next.rev++;
	next.sum += i*next.rev;
	Q.push(next);
      }
    }
  }
}

int main(){
  memset(dp,0,sizeof(dp));
  solve();
  while(cin >> n >> s) cout << dp[n][s] << endl;
  return 0;
}