#include <bits/stdc++.h>
const int N = 110, D = 26, mod = 1e9 + 7;
int dp[N][N * D];
char s[N];
int main() {
  dp[0][0] = 1;
  for (int i = 1; i < N; i++)
    for (int j = 0; j < N * D; j++)
      for (int k = 0; k < D; k++)
        if (j >= k) dp[i][j] = (dp[i][j] + dp[i - 1][j - k]) % mod;
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%s", s);
    int z = 0, n = strlen(s);
    for (int i = 0; i < n; i++) z += s[i] - 'a';
    int sol = dp[n][z] - 1;
    if (sol < 0) sol += mod;
    printf("%d\n", sol);
  }
  return 0;
}
