#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<bitset>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<list>
#include<queue>
#include<deque>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int ans = 0;

void find_sequence(list<int> numlist, int n, int s) {
    if (n == 0) {
        if (s == 0) ans += 1;
        return;
    }
    if (s > 9 * numlist.size()) {
        return;
    }

    REP(i, numlist.size()) {
        list<int>::iterator it = numlist.begin();
        REP(j, i)   it++;
        int k = *it;
        if (k * (11 - numlist.size()) <= s) {
            list<int> newlist;
            copy(numlist.begin(), numlist.end(), back_inserter( newlist ));
            newlist.remove(k);
            find_sequence(newlist, n - 1, s - k * (11 - numlist.size()));
        } else {
            return;
        }
    }
}

int main() {

    int n, s;
    while(cin >> n >> s && (n || s)) {
        ans = 0;
        list<int> numlist;
        REP(i, 10)  numlist.push_back(i);
        find_sequence(numlist, n, s);
        cout << ans << endl;
    }
    return 0;
}