#include<bits/stdc++.h>
namespace std
{
template<typename T1,typename T2,typename T3>struct triplet{
T1 first;T2 second;T3 third;
friend bool operator ==(triplet x,triplet y){return x.first==y.first&&x.second==y.second&&x.third==y.third;}
friend bool operator !=(triplet x,triplet y){return x.first!=y.first||x.second!=y.second||x.third!=y.third;}
friend bool operator <(triplet x,triplet y){return x.first==y.first?x.second==y.second?x.third<y.third:x.second<y.second:x.first<y.first;}
friend bool operator >(triplet x,triplet y){return x.first==y.first?x.second==y.second?x.third>y.third:x.second>y.second:x.first>y.first;}
friend bool operator <=(triplet x,triplet y){return x.first==y.first?x.second==y.second?x.third<=y.third:x.second<y.second:x.first<y.first;}
friend bool operator >=(triplet x,triplet y){return x.first==y.first?x.second==y.second?x.third>=y.third:x.second>y.second:x.first>y.first;}
friend triplet operator +(triplet x,triplet y){return (triplet){x.first+y.first,x.second+y.second,x.third+y.third};}
friend triplet operator -(triplet x,triplet y){return (triplet){x.first-y.first,x.second-y.second,x.third-y.third};}
triplet& operator +=(triplet x){return (*this)=(*this)+x;}
triplet& operator -=(triplet x){return (*this)=(*this)-x;}
};
template<typename T1,typename T2,typename T3>triplet<T1,T2,T3> make_triplet(T1 x,T2 y,T3 z){
triplet<T1,T2,T3> res;
res.first=x;res.second=y;res.third=z;return res;
}
}
#define Rep(i, n) for(int i=0; i< (int)(n); i++)
#define Rpp(i, n) for(int i=1; i<=(int)(n); i++)
#define Dpp(i, n) for(int i=(int)n; i; i--)
#define Frr(i, s, e) for(int i=(int)(s); i<=(int)(e); i++)
#define Tc int T; cin >> T; while(T--)
#define Eps 1e-7
#define Pinf 0x3f3f3f3f3f3f3f3fLL
#define Ninf (long long)0xcfcfcfcfcfcfcfcfLL
#define Mem0(Cont) memset(Cont, 0, sizeof(Cont))
#define MemP(Cont) memset(Cont, 0x3f, sizeof(Cont))
#define MemN(Cont) memset(Cont, 0xcf, sizeof(Cont))
#define endl '\n'
#define int long long
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define Yes cout << "Yes\n"
#define No cout << "No\n"
#define yes cout << "yes\n"
#define no cout << "no\n"
//#define Files
using namespace std;
template <typename T> inline void Print(T x, char ed = '\n') { cout << x << ed; }
template <typename T> inline void Exit(T x, int cd = 0) { cout << x << endl; exit(cd); }
template <typename T> inline bool CheckMax(T& x, T y) { if(x < y) { x = y; return 1; } else return 0; }
template <typename T> inline bool CheckMin(T& x, T y) { if(y < x) { x = y; return 1; } else return 0; }
inline void Print_if(bool sth, string s1 = "Yes", string s2 = "No") { if(sth) cout << s1 << endl; else cout << s2 << endl; }
template <int MM>
class ModInt {
int x;
void Simple() {
x %= MM;
}
public:
ModInt(int _x=0) : x((_x%MM+MM) % MM) {}
ModInt<MM> Inv() const {
return (*this)^(MM-2);
}
int Num() const {
return x;
}
bool operator! () const {
return !x;
}
ModInt<MM>& operator++() {
++x;
x == MM ? (x = 0) : x;
return *this;
}
ModInt<MM>& operator--() {
--x;
x < 0 ? (x += MM) : x;
return *this;
}
ModInt<MM> operator++(signed) {
Simple();
ModInt <MM> t = *this;
++x;
return t;
}
ModInt<MM> operator--(signed) {
Simple();
ModInt <MM> t = *this;
--x;
return t;
}
ModInt<MM>& operator+= (const ModInt<MM>& rh) {
return (*this) = (*this) + rh;
}
ModInt<MM>& operator-= (const ModInt<MM>& rh) {
return (*this) = (*this) - rh;
}
ModInt<MM>& operator*= (const ModInt<MM>& rh) {
return (*this) = (*this) * rh;
}
ModInt<MM>& operator/= (const ModInt<MM>& rh) {
return (*this) = (*this) / rh;
}
ModInt<MM>& operator^= (int x) {
return (*this) = (*this) ^ x;
}
template <int M>
friend bool operator== (ModInt<M> A, ModInt<M> B) {
return A.x == B.x;
}
template <int M>
friend bool operator!= (ModInt<M> A, ModInt<M> B) {
return A.x != B.x;
}
template <int M>
friend ModInt<M> operator^ (ModInt<M> x, int y) {
ModInt w = 1;
for(; y; y>>=1, x*=x) {
if(y & 1) w *= x;
}
return w;
}
template <int M>
friend ModInt<M> operator+ (ModInt<M> A, ModInt<M> B) {
A.x += B.x;
A.x >= M ? (A.x -= M) : A.x;
return A;
}
template <int M>
friend ModInt<M> operator- (ModInt<M> A, ModInt<M> B) {
A.x -= B.x;
A.x < 0 ? (A.x += M) : A.x;
return A;
}
template <int M>
friend ModInt<M> operator* (ModInt<M> A, ModInt<M> B) {
if(M <= 2147483633) {
A.x *= B.x;
A.Simple();
return A;
}
else {
int x = A.x, y = B.x, z = M;
int t = (long double) x * y / z;
unsigned int a = x * y, b = z * t;
int res = ((int)(a%z) - (int)(b%z) + z) % z;
ModInt<M> C = res;
return C;
}
}
template <int M>
friend ModInt<M> operator/ (ModInt<M> A, ModInt<M> B) {
return A * B.Inv();
}
template <int M>
friend istream& operator>>(istream& cin, ModInt<M>& A) {
int x;
cin >> x;
A = x;
return cin;
}
template <int M>
friend ostream& operator<<(ostream& cout, const ModInt<M>& A) {
return cout << (A.Num());
}
};
template <int M> ModInt<M> operator+ (ModInt<M> A, int x) {
ModInt<M> B = x; return A + B;
}
template <int M> ModInt<M> operator- (ModInt<M> A, int x) {
ModInt<M> B = x; return A - B;
}
template <int M> ModInt<M> operator* (ModInt<M> A, int x) {
ModInt<M> B = x; return A * B;
}
template <int M> ModInt<M> operator/ (ModInt<M> A, int x) {
ModInt<M> B = x; return A / B;
}
template <int M> ModInt<M> operator+ (int x, ModInt<M> A) {
ModInt<M> B = x; return A + B;
}
template <int M> ModInt<M> operator- (int x, ModInt<M> A) {
ModInt<M> B = x; return B - A;
}
template <int M> ModInt<M> operator* (int x, ModInt<M> A) {
ModInt<M> B = x; return A * B;
}
template <int M> ModInt<M> operator/ (int x, ModInt<M> A) {
ModInt<M> B = x; return B / A;
}
constexpr int M = 1e9+7, TT = 13300;
typedef ModInt<M> Mint;
string s; Mint dp[105][26666];
signed main()
{
#ifdef Files
freopen(".in", "r", stdin);
freopen(".out", "w",stdout);
#endif
ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
dp[0][0] = 1;
Rpp(i, 100) Rpp(j, 2600) Rpp(k, min(26ll, j))
dp[i][j] += dp[i-1][j-k];
Tc {
cin >> s;
int n = s.size();
s = '_' + s;
s += '_';
cout << dp[n][accumulate(s.begin()+1, s.end()-1, -n * 'a' + n)]-1 << endl;
}
return 0;
}