#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int dp[10][330];
bool used[10];

void solve(int k,int s)
{
    if(k == 11) return ;
    for(int i = 0; i < 10; i++){
        if(!used[i]){
            used[i] = true;

            dp[k+1][s + i * (k+1)]++;
            solve(k + 1,s + i * (k+1));

            used[i] = false;
        }
    }
}

int main()
{
    int n,s;
    solve(0,0);
    while(cin >> n >> s){
        if(s > 330){
            cout << 0 << endl;
        }else{
            cout << dp[n][s] << endl;
        }
    }
}

