#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int n,s;
bool used[10];
int cnt;

int solve(int k,int sum){
  if(sum > s*k) return 0;

  if(n == k){
    if(sum == s){
      return 1;
    }
    return 0;
  }

  int res = 0;
  for(int i = 0 ; i <= 9 ; i++){
    if(!used[i]){
      used[i] = true;
      res += solve(k + 1 , sum + ((k+1)*i));
      used[i] = false;
    }
  }  

  return res;
}

int main(){
  while(cin >> n >> s){
    cnt = 0;
    memset(used,false,sizeof(used));
    cout << solve(0,0) << endl;
  }
  
  return 0;
}