#include <bits/stdc++.h>
using namespace std;
const int Maxsum = 2600 + 5, mod = 1000 * 1000 * 1000 + 7;
long long b[Maxsum], bp[Maxsum];
long long power(int a, int b) {
  long long ans = 1;
  for (int i = 31; i >= 0; i--) {
    ans *= ans;
    ans %= mod;
    if ((b >> i) & 1) ans *= (long long)a;
    ans %= mod;
  }
  return ans;
}
long long c(int r, int n) {
  if (r > n) return 0;
  long long ans = b[n] * bp[r];
  ans %= mod;
  ans *= bp[n - r];
  ans %= mod;
  return ans;
}
long long ok(int s, int n) {
  long long ans = 0, a = 1;
  for (int i = 0; i <= n; i++) {
    ans += a * c(n - 1, s - 1 - (i * 26)) * c(i, n);
    ans %= mod;
    if (ans < 0) ans += mod;
    a *= -1;
  }
  ans--;
  ans %= mod;
  if (ans < 0) ans += mod;
  return ans;
}
int main() {
  b[0] = 1;
  for (int i = 1; i < Maxsum; i++) b[i] = (b[i - 1] * (long long)i) % mod;
  bp[0] = bp[1] = 1;
  for (int i = 2; i < Maxsum; i++) bp[i] = power(b[i], mod - 2);
  int n;
  cin >> n;
  string s;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    sum = 0;
    cin >> s;
    for (int j = 0; j < s.size(); j++) sum += (s[j] - 'a' + 1);
    cout << ok(sum, s.size()) << endl;
  }
  return 0;
}
