#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

int n;
int dp[10][1 << 10][331];
int rec(int now, int used, int sum)
{
    if (sum < 0)
        return 0;
    if (now == n)
        return sum == 0;

    if (~dp[now][used][sum])
        return dp[now][used][sum];

    int ret = 0;
    for (int i = 0; i < 10; ++i)
    {
        if ((used >> i) & 1)
            ret += rec(now + 1, used & ~(1 << i), sum - (now + 1) * i);
    }
    return dp[now][used][sum] = ret;
}
int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //cout << fixed << setprecision(7);
    int s;
    while (cin >> n >> s)
    {
        //cout << n << " " << s << endl;
        fill_n(**dp, 10 * (1 << 10) * 331, -1);
        cout << rec(0, (1 << 10) - 1, s) << endl;
    }

    return 0;
}
