#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <bitset>
using namespace std;

int n, s;

int c (int i, int sum, int t) {
    if (t == 0) return (sum == s ? 1 : 0);
    if (sum > s) return 0;
    int res = 0;
    for (int j = 0; j < 10; j++) {
        if ((i & 1 << j) > 0 && c(i - (1 << j), sum + j * t, t-1)) res++;
    }
    return res;
}

int main ()
{
    while (cin >> n >> s) {
        int res = 0;
        for (int i = 1; i < 1 << 10; i++) {
            int t = 0;
            for (int j = 0; j < 10; j++)
                if ((i & (1 << j)) > 0) t++;
            if (t == n) {
                res += c(i,0,t);
            }
        }
        cout << res << endl;
    }

    return 0;
}