#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, string>
const int INF = INT_MAX / 2;
const int N = 10;

int n, s;

int dfs(int sum, int cnt, vector<bool> used){
    //cout <<sum <<", " <<cnt <<endl;
    if(sum == s && cnt == n) return 1;
    else if(cnt >= n) return 0;
    int ret = 0;
    for(int i = 0; i < N && ((cnt + 1) * i) + sum <= s; i++){
        if(used[i]) continue;
        used[i] = true;
        ret += dfs(((cnt + 1) * i) + sum, cnt + 1, used);
        used[i] = false;
    }
    return ret;
}

int main(){
    while(cin >>n){
        cin >>s;
        cout <<dfs(0, 0, vector<bool>(N, false)) <<endl;
    }
    return 0;
}