Sereja has a string A consisting of n lower case English letters. 

Sereja calls two strings X and Y each of length n similar if they can be made equal by applying the following operation at most once in each of them.

- Chose any two position i, j in the string (i can be equal to j too). Swap the characters at position i with character at position j.

For example strings "abcd" and "acbd" are similar, strings "ab" and "ab" are similar, but strings "abcde" and "bcdea" are not similar. Note that strings  "abc" and "cab" are also similar, as you can swap 'a' and 'c' in the first string to get "cba" and 'a' and 'b' in the second string to get "cba". 

Now Sereja is interested in finding number of ordered pairs of non similar strings X and Y such that they can be constructed from a given string A by permutation of its characters. As answer could be large, please output your answer modulo  (109 + 7).

Note 

A string s (of size n) is said to be constructed from string t (also of size n) by permutation of its characters if there exists a permutation P (of length n), such that s[i] = t[P[i]] for each i from 1 to n.

-----Input-----
- First line contain integer T - number of test cases. 
- For each of the next T lines: 
	
- Each line contains a string A as defined in the problem.

-----Output-----
For each test case, output answer modulo 1000000007 (109 + 7) in separate line. 

-----Constraints-----
- 1 ≤ T ≤  10 
- 1 ≤ n ≤  10^5 

-----Constraints-----
- Subtask #1: 1 ≤ n ≤  10  (25 points)
- Subtask #2: 1 ≤ n ≤  100  (25 points)
- Subtask #3: 1 ≤ n ≤  1000  (25 points)
- Subtask #4: original constraints (25 points)

-----Example-----
Input:
2
z
abcd

Output:
0
144

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "from math import factorial as ff\nfrom itertools import permutations as p\nfrom itertools import combinations as cc\na=ff(4)%10\nauthor='biggy_bs'\ndef egcd(a, b):\n    if a == 0:\n        return (b, 0, 1)\n    else:\n        g, y, x = egcd(b % a, a)\n        return (g, x - (b // a) * y, y)\n \ndef modinv(a, m):\n    g, x, y = egcd(a, m)\n    if g != 1:\n        raise Exception('modular inverse does not exist')\n    else:\n        return x % m\ndef factorialMod(n, modulus):\n    ans=1\n    l=[]\n    if n <= modulus//2:\n        #calculate the factorial normally (right argument of range() is exclusive)\n        for i in range(1,n+1):\n            ans = (ans * i) % modulus\n            l.append(ans)\n    return l\ndef precomputation():\n    nC2=[0]*100002\n    nC3=[0]*100002\n    nC4=[0]*100002\n    for i in range(100002):\n        if i>=1:\n            nC2[i]=((i)*(i-1))/2\n        else:\n            nC2[i]=0\n        if i>=2:\n            nC3[i]=(i*(i-1)*(i-2))/6\n        else:\n            nC3[i]=0\n        if i>=3:\n            nC4[i]=(i*(i-1)*(i-2)*(i-3))/24\n        else:\n            nC4[i]=0\n    return (nC2,nC3,nC4)\ndef count_two(arr,mod):\n    ans=0\n    for i in range(26):\n        if arr[i]==0:\n            continue\n        for j in range(i+1,26):\n            if arr[j]==0:\n                continue\n            ans=(ans+arr[i]*arr[j])%mod\n            ans=(ans+((((((arr[i]*arr[j]%mod)*(arr[i]-1)%mod ) * (arr[j]-1))%mod) * modinv(4,mod))%mod))%mod\n            for k in range(j+1,26):\n                if arr[k]==0:\n                    continue\n                ans=(ans +(((arr[i]*arr[j]%mod)*arr[k]%mod)*2)%mod)%mod\n                ans=(ans +(((arr[i]*arr[j]%mod)*arr[k]%mod)*(arr[i]-1))%mod)%mod\n                ans=(ans +(((arr[i]*arr[j]%mod)*arr[k]%mod)*(arr[j]-1))%mod)%mod\n                ans=(ans +(((arr[i]*arr[j]%mod)*arr[k]%mod)*(arr[k]-1))%mod)%mod\n                for l in range(k+1,26):\n                    if arr[l]==0:\n                        continue\n                    ans=(ans+(((((arr[i]*arr[j]%mod)*arr[k]%mod)*arr[l])%mod)*3)%mod)%mod\n    return ans\n                      \nmod=10**9+7\nfact=factorialMod(100002,mod)\npre=precomputation()\nnC2=pre[0]\nnC3=pre[1]\nnC4=pre[2]\nf=[0]*100002\nt=eval(input());dic={}\nwhile t>0:\n    t-=1\n    s=input()\n    len_s=len(s)\n    if len_s>100:\n        pass\n    dic={}\n    arr=[0]*26\n    for i in s:\n        try:\n            dic[i]+=1\n        except:\n            dic[i]=1\n    for i in s:\n        arr[ord(i)-97]+=1\n    answer_two=count_two(arr,mod)\n    answer_two=(answer_two%mod + 1%mod)%mod\n    count_one=0\n    for i in range(26):\n        try:\n            qww=dic[chr(i+97)]%mod\n            for j in range(i+1,26):\n                try:\n                    count_one=(count_one%mod + qww*dic[chr(j+97)]%mod)%mod\n                except:\n                    break\n        except:\n            break\n    xxx=fact[len_s-1]%mod\n    for i in dic:\n        xxx=(xxx%mod * modinv(fact[dic[i]-1]%mod,mod))%mod\n    ans=(xxx*xxx)%mod\n    #print count_one\n    zero=xxx\n    one=(xxx * count_one%mod)%mod\n    if len(dic)==len_s:\n        aa=len_s-2\n        two=(aa%mod * (aa+1)%mod *(aa+2)%mod * (3*aa + 5)%mod * modinv(24,mod))%mod\n        #print two\n    elif len(dic)==2 and ((dic[s[0]]==1) or dic[s[0]]==len_s-1 or dic[s[0]]==len_s):\n        two=0\n    else:\n        two=1\n    two=(two%mod * xxx)%mod\n    answer_two=(answer_two%mod * xxx%mod)%mod\n    ct=0\n    if len_s<=3:\n        print(0)\n    else:\n        print((ans-(answer_two)%mod)  % mod)  \n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14420178