#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, k;
    vector<map<int, int>> m(1024), ans(11);
    vector<int> cnt(1024, 1);
    m[0][0]++;
    for (int i = 0; i < (1 << 10); ++i) {
        for (int j = 0; j < 10; ++j) {
            if(!(i& (1 << j))){
                cnt[i^(1 << j)] = cnt[i]+1;
                for (auto &&l : m[i]) {
                    m[i^(1 << j)][l.first+(cnt[i])*j] += l.second;
                }
            }
        }
        for (auto &&j : m[i]) {
            ans[cnt[i]-1][j.first] += j.second;
        }
    }
    while(cin >> n >> k){
        cout << ans[n][k] << "\n";
    }
    return 0;
}
