#include<iostream>
#include<queue>

using namespace std;

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

int n,s;
int ans;

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 == n){
      if(now.sum == s) ans++;
      continue;
    }
    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(){
  while(cin >> n >> s){
    ans = 0;
    solve();
    cout << ans << endl;
  }
  return 0;
}