#include<cstdio>
#include<iostream>

using namespace std;

int n,s,ans;
int use[10];

void solve(int now,int kei){
	if(now==n){
		if(s==kei){
			ans++;
		}
		return;
	}

	for(int i=0;i<=9;i++){
		if(use[i]==0){
			use[i]=1;
			solve(now+1,kei+i);
			use[i]=0;
		}
	}
}

int main(void){

	while(1){
		cin>>n>>s;
		ans=0;
		for(int i=0;i<10;i++) use[i]=0;
		if(n==0||s==0) break;
		solve(0,0);
		cout<<ans/6<<endl;
	}

	return 0;
}