#include <cstdio>
#include <iostream>
#include <map>
using namespace std;
map<pair<int,pair<int,int> > , int> dp;
int solve(int bit,int i,int sum){
  if(!i) return (sum)?0:1;
  if(dp.find(make_pair(bit,make_pair(i,sum))) != dp.end()) return dp[make_pair(bit,make_pair(i,sum))];
  int ret = 0;
  for(int j = 0; j < 10; j++){
    if(bit & 1<<j) continue;
    ret += solve(bit | 1<<j,i-1,sum-j*i);
  }
  return dp[make_pair(bit,make_pair(i,sum))] = ret;
}
int main(void){
  int n,s;
  while(cin >> n >> s){
    cout << solve(0,n,s) << endl;
  }
}