#include <cassert>
#include <iostream>
template<typename V>
class List {
public:
	List(const V &head, const List<V> &tail) :_head{ head }, _tail{ &tail }, _size{ tail.size() + 1 } {}
	explicit List(const V &head) :_head{ head } {};
	List const tail() const{
		return *_tail;
	}
	V head() const {
		return _head;
	}
	size_t size() const {
		return _size;
	}
	List const operator+(const V &head) const {
		return List(head, *this);
	}
	template<typename F>
	auto reduce_left(const F &f) const  {
		assert(_tail);
		return tail()->_reduce_left(f, _head);
	}
	template <typename F>
	auto any(const F &f) const -> decltype(f(head())) {
		return f(head()) || (_tail && tail().any(f));
	}
	template<typename F>
	auto all(const F &f) const ->decltype(f(head())) {
		return f(head()) && (!_tail || tail().all(f));
	}
private:
	template <typename F>
	auto _reduce_left(const F &f, const V &prev) const ->decltype(f(prev, head())) {
		if (_tail)
			return tail()._reduce_left(f, f(prev, head()));
		else
			return f(prev, head());
	}
	List const * const _tail{ nullptr };
	const V _head;
	size_t _size{ 1 };
};

int dfs(const List<int> &list, const int n, const int s) {
	if (list.size() == n || s < 0) {
		if (s == 0) return 1;
		else return 0;
	}
	else {
		int sum = 0;
		for (auto i = 0; i < 10; ++i) {
			if (list.all([i](int h) {return h != i; })) {
				sum += dfs(list + i, n, s - (list.size() + 1) * i);
			}
		}
		return sum;
	}
}
int main() {
	for (int n, s; std::cin >> n >> s;) {
		int sum = 0;
		for (auto i = 0; i < 10; ++i) {
			sum += dfs(List<int>(i), n, s);
		}
		std::cout << sum << std::endl;
	}
	return 0;
}