module Memoizable
	def memoize(name)
		original = "__original_#{name}__"
		([Class, Module].include?(self.class) ? self : self.class).class_eval {
			alias_method(original, name)
			private(original)
			cache = {}
			define_method(name){|*args|
				cache[args] ||= send(original, *args)
			}
		}
	end 

	#def memoize(name)
	#	original = "__original_#{name}__"
	#	klass = ([Class, Module].include?(self.class) ? self : self.class)
	#	klass.class_eval <<-"EOS"
	#		alias_method('#{original}', '#{name}')
	#		private('#{original}')
	#		@@cache_for_#{name} = {}
	#		def #{name}(*args)
	#			@@cache_for_#{name}[args] ||= send('#{original}', *args)
	#		end
	#	EOS
	#end 
end
include Memoizable

def f(s, k, min, max)
	if k == 1
		return min <= s && s <= max ? 1 : 0
	end

	count = 0
	(min..max-1).each{|x|
		count += f(s-x, k-1, x+1, max)
	}
	count 
end

memoize :f

loop {
	n, k, s = gets.split.map &:to_i
	break if n == 0
	p f(s, k, 1, n)
}