#include <bits/stdc++.h>
using namespace std;
long long MODN = 1000000007;
long long combs[2800][115];
int maxn = 2701, maxr = 110;
void init() {
  for (int i = 0; i < maxn; i++) {
    combs[i][0] = 1;
    combs[i][i] = 1;
    combs[i][1] = i;
  }
  combs[0][0] = 0;
  for (int i = 0; i < maxr; i++) {
    if (i > 1) combs[1][i] = 0;
  }
  for (int i = 2; i < maxn; i++) {
    for (int j = 2; j < maxr; j++) {
      combs[i][j] = (combs[i - 1][j] + combs[i - 1][j - 1]) % MODN;
    }
  }
}
int main() {
  init();
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int sum = 0;
    for (int i = 0; i < s.size(); i++) {
      sum += s[i] - 'a';
    }
    int N = s.size();
    if (N < 2) {
      cout << "0\n";
      continue;
    }
    long long ways = 0;
    long long bit = 0;
    for (int i = 0; i <= N; i++) {
      if (sum - 26 * i < 0) break;
      if (i % 2 == 0)
        bit = 1;
      else
        bit = -1;
      bit = bit * combs[N][i];
      int n_ = sum - (26 * i) + N - 1;
      if (n_ <= 0) break;
      int r_ = N - 1;
      if (n_ < r_) {
        bit = 0;
      } else
        bit = (bit * combs[n_][r_]) % MODN;
      ways = (ways + bit) % MODN;
    }
    if (ways <= 0) {
      ways += MODN;
    }
    cout << ways - 1 << endl;
  }
  return 0;
}
