AlgoUniversity
  • Go Back
Discussion
Stone Cold Mafia :

Author

Yash Sahijwani

Difficulty Level : Easy

Submissions : 303

Asked In : Gameskraft

Marks :10

: 5 | : 1

Stone Cold is an American actor, producer, television host, and most importantly a famous professional wrestler. He has invented a new game which he named on himself - Stone Cold Mafia. In the game, you need to arrange his trophies on a tray. The size of tray is $$$N$$$ and the different types of trophies are $$$K$$$.

You want to place these trophies on the tray next to each other such that no trophy of the same type is sitting adjacent. Also, there is a special trophy $$$X$$$ which means trophies of type $$$X$$$ are allowed to place adjacent to each other.

Find the number of such possible arrangements mod $$$10^9 +7$$$

Input

The first line of input consists of 3 space separated integers $$$-$$$ $$$N$$$, $$$K$$$ and $$$X$$$. $$$(1 \leq N \leq 10^5)$$$ $$$(1 \leq K, X \leq 5)$$$

Output

The output should consist of a single integer $$$-$$$ the total number of such possible arrangements modulo $$$10^9+7$$$

Examples

Input
3 2 1
Output
5
Input
5 4 3
Output
469

Note

You can assume that the number of trophies of each type is infinite and so you can you use as many trophies of each type in the arrangement. Also, X can be greater than K meaning that no there is no special trophy.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.