#include <bits/stdc++.h>
using namespace std;
long long int c[2750][2750];
long long int cc(long long int n, long long int m) {
  if ((n >= 0) && (m >= 0) && !(c[n][m] == -1LL)) {
    return c[n][m];
  }
  if (n == 0LL) {
    c[n][m] = 1;
    return c[n][m];
  }
  if (m == 0LL || n < 0LL) {
    if ((n >= 0) && (m >= 0)) c[n][m] = 0;
    return 0;
  }
  c[n][m] = 0LL;
  for (int i = 0; i < 26; ++i) {
    c[n][m] = (c[n][m] + cc(n - i, m - 1)) % 1000000007LL;
  }
  return c[n][m];
}
int main() {
  long long int t, n, j, ss;
  for (int i = 0; i < 2750; i++)
    for (j = 0; j < 2750; j++) c[i][j] = -1LL;
  string s;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    cin >> s;
    n = 0;
    while (s[n]) ++n;
    ss = 0;
    for (j = 0; j < n; ++j) ss += int(s[j]) - int('a');
    cout << (cc(ss, n) - 1) % 1000000007LL << endl;
  }
  return 0;
}
