Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/kombinatorika-sozlar-soni

Words from letters

Medium 1000 ms 128 MB 53%
Share

A word $s$ is given. How many different words can be made by using all of its letters (each exactly once) and changing their order? A word need not be meaningful, and $s$ itself also counts. Print the answer modulo $10^{9} + 7$.

Equal letters have the same color; their different arrangements

Input

One line with the word $s$.

Output

One integer — the number of words modulo $10^{9} + 7$.

Note

$1 \le |s| \le 10^{5}$
$s$ consists only of lowercase Latin letters (a–z)

Examples

Input #1
mama
Output #1
6
Input #2
a
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.