Pheatr has a lot of accounts competing in online programming contests such as contests on TopForces.
Sometimes when Pheatr participates in a contest on TopForces but cannot attain a good score directly, he takes advantage of some extra accounts applied for cheating (i.e. sockpuppets) to achieve a higher score:
Initially, he builds some wrong codes which can pass the pre-system tests and submits them through the sockpuppets.
After that, he uses his main account to challenge these sockpuppets immediately, since a successful challenge provides him $100$ more score points.
Actually, Pheatr is not the only one who cheats in the contests.
Many competitors use the same strategy during online programming contests.
Everyone has only one account as the main account.
If one's cheating is revealed, the main account of the one will be banned forever.
To prevent the notorious fact from being exposed, each competitor would not register more than two sockpuppets.
In spite of great peril, when they register their sockpuppets, these competitors always follow the same rule that the username of a sockpuppet belonging to one competitor should be a prefix of that of the competitor's main account, otherwise the username of the main account should be a prefix of that of the sockpuppet.
Recently, a leak from TopForces provided a list of verified cheaters who have used sockpuppets for cheating, containing the usernames of their main accounts.
Besides, TopForces also published a list of suspicious accounts, implying some of them may be sockpuppets.
In order to differentiate these suspicious accounts and point out their owners, Pheatr intends to describe all the possibilities according to the published information.
Certainly, one should notice that some of the suspicious accounts may be wronged and do not belong to any known cheaters.
After recognizing your outstanding programming skills, Pheatr asks you to count the number of distinct possibilities in total for claiming the affiliations between verified cheaters and suspicious accounts.
Two possibilities are considered the same if each suspicious account is wronged simultaneously or belongs to the same competitor in both possibilities.
Since the answer can be pretty large, you are only asked to report the answer modulo $(10^9 + 7)$.