#include <bits/stdc++.h>
const int oo = 1000000007;
int i, j, k, N, sum, l, f[110][2510];
char s[110];
int main() {
  f[0][0] = 1;
  for (i = 1; i <= 100; i++)
    for (j = 0; j < 26; j++)
      for (k = 2500; k >= j; k--) f[i][k] = (f[i][k] + f[i - 1][k - j]) % oo;
  scanf("%d", &N);
  gets(s);
  for (; N--;) {
    gets(s);
    l = strlen(s);
    sum = 0;
    for (i = 0; i < l; i++) sum += s[i] - 97;
    printf("%d\n", f[l][sum] - 1);
  }
  return 0;
}
