#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
const int MAXC = 3010;
char str[MAXN];
int sz;
long long comb[MAXC][MAXC];
const int mod = 1e9 + 7;
long long H(int n, int r) {
  if (r < 0) return 0;
  return comb[n + r - 1][n - 1];
}
int main() {
  int T;
  for (int i = 1; i <= 3000; i++) {
    comb[i][i] = comb[i][0] = 1LL;
    for (int j = 1; j < i; j++) {
      comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % mod;
    }
  }
  scanf(" %d", &T);
  long long res;
  for (int i = 1, cur; i <= T; i++) {
    cur = 0;
    scanf(" %s", str + 1);
    sz = strlen(str + 1);
    for (int i = 1; i <= sz; i++) cur += str[i] - 'a';
    if (sz == 1) {
      printf("0\n");
      continue;
    }
    res = 0LL;
    for (int i = 0; i <= sz; i++) {
      res += pow(-1, i) * ((comb[sz][i] * H(sz, cur - 26 * i)) % mod);
      while (res < 0) res += mod;
      res %= mod;
    }
    cout << (res - 1 + mod) % mod << endl;
  }
  return 0;
}
