#include <bits/stdc++.h>
using namespace std;
string char_to_str(char c) {
  string tem(1, c);
  return tem;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class T>
T rand() {
  return uniform_int_distribution<T>()(rng);
}
long long modinverse(long long a, long long b) {
  long long b0 = b, t, q;
  long long x0 = 0, x1 = 1;
  if (b == 1) return 1;
  while (a > 1) {
    q = a / b;
    t = b, b = a % b, a = t;
    t = x0, x0 = x1 - q * x0, x1 = t;
  }
  if (x1 < 0) x1 += b0;
  return x1;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t;
  cin >> t;
  long long mo = 1000000007;
  long long f[100000];
  f[0] = 1;
  for (long long i = 1; i < 100000; ++i) f[i] = (i * f[i - 1]) % mo;
  while (t) {
    --t;
    string s;
    cin >> s;
    long long n;
    n = s.length();
    long long su = 0;
    for (long long i = 0; i < n; ++i) su += s[i] - 'a';
    long long ans = 0;
    for (long long i = 0; i <= su && i <= n; ++i) {
      if (su - 26 * i < 0) continue;
      long long v = 1;
      v *= (f[n] * ((modinverse(f[i], mo) * modinverse(f[n - i], mo)) % mo)) %
           mo;
      if (i % 2 == 1) {
        v *= mo - 1;
        v %= mo;
      }
      long long j = su - 26 * i;
      v *= (f[n + j - 1] *
            ((modinverse(f[j], mo) * modinverse(f[n - 1], mo)) % mo)) %
           mo;
      v %= mo;
      ans += v;
      ans %= mo;
    }
    cout << (ans - 1 + mo) % mo << "\n";
  }
}
