During the Lunar New Year, Bugcat has been playing a Mahjong-themed "roguelike" game (similar to Balatro). In this game, Bugcat draws tiles from a deck and discards them, and it has perfect knowledge of the tile sequence in the "wall" (the deck).
Bugcat starts wondering: if there is a Mahjong set with $$$n$$$ distinct types of tiles, what is the expected number of tiles drawn (including the initial $$$13$$$ tiles) to complete a "Four Concealed Pongs" (Sūankō) hand, assuming optimal play? Output the result modulo $$$10^9 + 7$$$.
Definitions:
Simplified Problem Statement:
There are $$$4n$$$ tiles, categorized into $$$n$$$ colors (types), with $$$4$$$ tiles per color. Even tiles of the same color are considered distinct.
Consider all $$$(4n)!$$$ possible permutations of the deck. For a given permutation, let the "cost" be the smallest index $$$i$$$ such that among the first $$$i$$$ tiles in the sequence, the following two conditions are met:
Find the expected value of the cost $$$i$$$ over all possible permutations. Output the result modulo $$$10^9 + 7$$$.
A single integer $$$n$$$ ($$$1 \le n \le 2 \times 10^6$$$), representing the number of tile types.
A single integer representing the expected cost modulo $$$10^9 + 7$$$.
5
80495372
4
0