#include <iostream>
#include <algorithm>
#include <map>
 
#define mp(x, y) make_pair(x, y)
#define ALL(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define each(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
 
using namespace std;
 
typedef long long LINT;
 
const LINT MAX = 10;
 
int N, S;
map<int, LINT> d[1 << MAX][MAX];
 
int bit ( int n )
{
    int res = 0;
    for (int i = 0; i < MAX; ++i) {
        if (n & (1 << i)) { ++res; }
    }
    return res;
}
 
int main ( void )
{
    while (cin >> N >> S) {
        int ans = 0;
        for (int i = 0; i < MAX; ++i) {
            int state = 1 << i;
            d[state][i].insert(mp(i, 1));
        }
        for (int state = 1, I = 1 << MAX; state < I; ++state) {
            int b = bit(state);
            for (int i = 0; i < MAX; ++i) {
                if (!(state & (1 << i))) {
                    int next = state | (1 << i);
                    for (int j = 0; j < MAX; ++j) {
                        if (state & (1 << j)) {
                            each(d[state][j], p) {
                                LINT num = i * (b+1) + (*p).first;
                                d[next][i][num] += (*p).second;
                            }
                        }
                    }
                }
            }
            if (b == N) {
                for (int i = 0; i < MAX; ++i) {
                    ans += d[state][i][S];
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}