You are given N red pieces of candy and M blue pieces of candy. Write a program to find the number of arrangements of candy in which not more than K pieces of the same color are placed next to each other.

Sample test case-

Input format = N M K

Input = 1 1 1 (Output = 2) (Explanation = possible combinations are RB BR which satisfies above condition)

Input = 2 1 1 (Output = 1) (Explanation = possible combinations are RRB RBR BRR but only RBR satisfies above condition)

Anyone pls help how to do this?