Phonepe | PSDS | Find Number of ways to arrange ballons

Anonymous User
828
Oct 25, 2022
Oct 25, 2022

Your friend's birthday is nearby. He asked you to take care of balloon decoration. He has bought
White and Yellow balloons of N and M quantities respectively. You have to decorate the balloons by placing the balloons in a straight line in any order. He likes a decoration when there are no more than W white balloons placed successively or there are no more than Y yellow balloons placed successively.

Your friend wants to know the number of decorations that are possible from given input such that he likes the decorations.

Note: A line filled with balloons in any order is considered as a decoration.

Input
The first and the only line contains four space separated integers N, M, W, Y
1 <= N, M <= 100
1 <= W,Y <=10

Output:
Print the number of decorations your friend will like modulo 100000000

Test case 1

2 1 1 10

Output: 1

Only possible way to arrange is “white, yellow, white”

Note: “white, white, yellow” or “yellow, white, white” not possible because we cannot have more than 1 white.

Test case 2

2 3 1 2

Output: 5

Comments (5)