Need help in a Combinatorics problem

The Questions was asked in a coding round
There are N RED balls and M BLACK balls output should be the total number to arrangements with almost K balls can be together.

ex:
Input:
n = 3 m = 2 k =1
Output:
1
explantion:
RBRBR

input:
n = 2 n = 2 k =1
output:
2
explantion:
RBRB
BRBR