#include<iostream>
#include<algorithm>
using namespace std;
int dp[10][1<<10][331], n; //nの制約は自明だけど sはどれくら(ry ← 331か
int rec( int now, int used,int sum){
  if( sum < 0 ) return 0;
  if( now == 0 ) return sum == 0;
  if(~dp[now - 1][used][sum]) return dp[now - 1][used][sum];
  int ret = 0;
  for(int i = 0 ; i < 10 ; i++ ){
    if((used >> i) & 1) continue;
    ret += rec( now - 1, used|(1 << i), sum - i * now);
  }
  return dp[now - 1][used][sum] = ret;
}
int main(){
  int s;
  fill_n( **dp, 10 * (1 << 10) * 331, -1); //初期化は1回だけで良い気が
  while(cin >> n >> s)
    cout << rec( n, 0, s) << endl;
}