#include <iostream>
#include <cstring>

using namespace std;

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

void solve(int k,int sum){
  if(sum > s) return;
  dp[k][sum] = cnt;

  if(n == k){
    if(sum == s){
      cnt++;
    }
    return;
  }

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

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

  return 0;
}