The following problem describes a simplified version of the game “Cats & Soup: Magic Recipe.”
There are two types of items: stars and moons. Each item has a level from through . An inventory has slots and is initially empty. Each item occupies one slot.
You may perform the following actions any number of times.
Items cannot be discarded or changed in any other way. You may choose each action based on the current inventory and all previous generation results.
Your goal is to create a level- star at least once. Find the maximum probability of achieving this goal over all strategies. Write this probability as a reduced fraction and output , where is the multiplicative inverse of modulo .
The input is given in the following format:
Print the required value as an integer from through .
The goal is reachable only if the first two generated items are both stars. The probability is , represented by modulo .
Generating any star succeeds. With all available merges performed, failure occurs only when the first seven generated items are all moons. The maximum probability is .
| 3 |
| 60 |
No additional constraints. |