#include <iostream>

int used[10];

void solve(int& sum,
           const int& s, int limit,
           long long int& cnt) {
    
    if (limit == 0) {
        if (sum == s) {
            ++cnt;
        }

        return;
    }

    int tmp;

    for (int i = 9; i >= 0; --i) {
        if (used[i]) {
            continue;
        }
        int est_sum = 0;
        int coef = 9;
        for (int j = limit - 1; j > 0; --j) {
           
            while (used[coef]) {
                --coef;
            }
            if (coef == i) {
                --coef;
            }
            while (used[coef]) {
                --coef;
            }
            est_sum += coef * j;
            --coef;
        }
        tmp = i * limit;
        sum += tmp;

        if (est_sum + sum < s) {
            sum -= tmp;
            break;
        }

        used[i] = 1;
        solve(sum,
            s, limit - 1,
             cnt);
        used[i] = 0;
        sum -= tmp;
    }
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int s, n;
    int sum = 0; 
    while (std::cin >> n >> s) {
        long long int cnt = 0;
        solve(sum, s, n, cnt);

        std::cout << cnt << std::endl;
    }

    return 0;
}