Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		N, K, S := io.NextInt(), io.NextInt(), io.NextInt()
		if N == 0 {
			break
		}
		dp := [21][11][156]int{}
		for i := 0; i <= N; i++ {
			dp[i][0][0] = 1
		}
		for i := 1; i <= N; i++ {
			for j := 1; j <= K; j++ {
				for k := 1; k <= S; k++ {
					if k-i >= 0 {
						dp[i][j][k] += dp[i-1][j-1][k-i]
					}
					dp[i][j][k] += dp[i-1][j][k]
				}
			}
		}
		io.Println(dp[N][K][S])
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

Python: import itertools

while True:
  n, k, s = map(int, input().split())
  if n + k + s == 0:
    break

  a = itertools.combinations(range(n + 1), k)

  ans = 0

  for e in a:
    if sum(e) != s:
      continue
    ans += 1

  print(ans)

Python: import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n,k,s = LI()
        if n == 0 and k == 0 and s == 0:
            break
        d = collections.defaultdict(int)
        d[(0,0)] = 1
        for i in range(1,n+1):
            for kk,vv in list(d.items()):
                if kk[0] == k or kk[1] + i > s:
                    continue
                d[(kk[0]+1,kk[1]+i)] += vv

        rr.append(d[(k,s)])

    return '\n'.join(map(str, rr))


print(main())

Python: import itertools

while True:
    N, K, S = map(int, input().split())
    if N == K == S == 0:
        break
    ans = 0
    for l in itertools.combinations(range(1, N+1), K):
        if sum(l) == S:
            ans += 1
    print(ans)

Python: def rec(n, u, k, s):
    if k == 1:
        if u < s <= n:
            return 1
        else:
            return 0

    ret = 0
    for i in range(u + 1, n - k + 2):
        ret += rec(n, i, k - 1, s - i)

    return ret

while True:
    n, k, s = map(int, input().split())
    if n == k == s == 0:
        break

    print(rec(n, 0, k, s))

Python: memo = {}
def dfs(N, K, S):
    key = (N, K, S)
    if key in memo:
        return memo[key]
    if N == 0:
        return S == K == 0
    r = dfs(N-1, K, S)
    if S >= N:
        r += dfs(N-1, K-1, S-N)
    memo[key] = r
    return r

ans = []
while 1:
    N, K, S = map(int, input().split())
    if N == 0:
        break
    ans.append(dfs(N, K, S))
print(*ans, sep='\n')

Python: import itertools
while True:
    N, K, S = map(int, input().split())
    if not N: break
    print(sum(sum(l) == S for l in itertools.combinations(range(1, N+1), K)))

Python: from itertools import combinations as c
while True:
    n,k,s= map(int, input().split())
    if n==0: break
    print(sum(1 for l in list(c(range(1,n+1),k)) if sum(l)==s))

Python: def dfs(v, k, s):
    if k == K:
        return 1 if s == S else 0
    res = 0
    for i in range(v + 1, N + 1):
        res += dfs(i, k + 1, s + i)
    return res

while True:
    N, K, S = map(int, input().split())
    if not N:
        break
    print(dfs(0, 0, 0))

Python: #!/usr/bin/env python
# -*- coding: utf-8 -*-

from itertools import combinations

while True:
    n,k,s = map(int,input().split(" "))
    if n == 0 and k == 0 and s == 0:
        break
    print(sum([1 if sum(t) == s else 0 for t in combinations(range(1,n+1),k)]))

Python: import itertools

while True:
    N, K, S = map(int, input().split())
    if N == K == S == 0:
        break
    print(sum(1 for l in itertools.combinations(range(1, N+1), K) if sum(l) == S))

Python: from itertools import combinations
while 1:
    n,k,s=map(int,input().split())
    if n==k==s==0:break
    a=0
    for i in combinations(range(1,n+1),k):
        if len(set(i))<k:continue
        a+=sum(i)==s
    print(a)

Python: import itertools
while True:
    N,K,S = map(int,input().split())
    if N == 0: break
    cnt = 0
    for comb in itertools.combinations(range(1,N+1),K):
        if sum(comb) == S:
            cnt += 1
    print(cnt)

Python: import itertools

while True:
  n, k, s = map(int, input().split())
  if n + k + s == 0:
    break

  a = itertools.combinations(range(1, n + 1), k)

  ans = 0

  for e in a:
    if sum(e) != s:
      continue
    ans += 1

  print(ans)

Python: import itertools
while 1:
    n,k,s=map(int,input().split())
    if n==0:break
    print(sum([1 if sum(i) == s else 0 for i in itertools.combinations(range(1,n+1),k)]))

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<string>
using namespace std;

inline int ReadInt() {
  char c;
  int ret(0);
  bool f(false);
  do c = getchar();
  while ((c < '0' || c > '9') && c != '-');
  if (c == '-') f = true, c = getchar();
  do ret = ret * 10 + c - '0', c = getchar();
  while ( c >= '0' && c <= '9');
  return f ? -ret : ret;
}

void Solve(const int &n, const int &k, const int &s, int &ans, 
	   const int &deep = 0,
	   const int &last = 0,
	   const int &sum = 0) {
  if (deep == k) {
    if (sum == s) ++ans;
    return;
  }
  for (int i(last+1); i <= n; ++i) {
    Solve(n, k, s, ans, deep + 1, i, sum + i);
  }
}

int main() {
  //freopen("t.txt","r",stdin);
  ios::sync_with_stdio(false);
  int n, k, s;
  while (cin >> n >> k >> s && n && k && s) {
    int ans(0);
    Solve(n, k, s, ans);
    cout << ans << endl;
  }
  return 0;
}