#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <utility>
#include <queue>
#include <stdio.h>
#include <string>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000007
using namespace std;
typedef long long int ll;

vector<int> used(10,0);
int n, s, ans;

void solve(int m, int sum){
    if (m==0) {
        if (sum == s) {
            ans++;
        }
        //cout << "|"<<ans<<"|"<<endl;
        return;
    }
    for (int i=0; i<10; i++) {
        if (used[i]==0) {
            //cout << i <<" "<<m<< endl;
            used[i]=1;
            solve(m-1, sum+i);
            used[i]=0;
        }
    }
}


int main(){
    while (1) {
        cin >> n >> s;
        if(n==0 and s == 0) break;
        ans = 0;
        solve(n, 0);
        cout << ans/6 <<endl;
    }
}