By Leandro Zatesko, UFFS Brasil
A long time ago, in a galaxy far, far away, the Unidade Federativa Fazedora de Segredos (UFFS) often used to send e-mails to the Unidade Receptora do Império (URI) with the codes that should be changed every hour in the Death Star security system. Fearing that the e-mails could be intercepted by the Rebel Alliance, UFFS signed each e-mail with one of the 12 different anagrams of its own acronym, as FUFS or SUFF, for example. It has not taken so long to the habit turn into an addiction among the imperial organs, and some more curious stormtroopers started to ask themselves how many anagrams would have any word.
The input consists of a list of words, one per line, and ends up with EOF (end of file). A word in turn is composed by at least one and at most 103 letters of the latin alphabet, capital only, with no blank spaces nor any other symbols.
For each word print a line containing an integer which represents the number of anagrams which is possible to form with that word. As this number can be very big, print just the remainder it leaves when divided by 109 + 7.
|Sample Input||Sample Output|