#include <bits/stdc++.h>
using namespace std;
const int p = int(1e9) + 7;
char ss[10000];
int a[1000], f[111][2700], t, n;
int main() {
  scanf("%d", &t);
  gets(ss);
  f[0][0] = 1;
  for (int i = 0; i <= 100; ++i)
    for (int j = 0; j <= 2600; ++j) {
      int x = f[i][j];
      if (x != 0)
        for (int k = 0; k < 26; ++k)
          f[i + 1][j + k] = (f[i + 1][j + k] + x) % p;
    }
  while (t > 0) {
    t--;
    gets(ss);
    n = strlen(ss);
    int sum = 0;
    if (n == 1) {
      printf("0\n");
      continue;
    }
    for (int i = 0; i < n; ++i) sum += ss[i] - 'a';
    printf("%d\n", (f[n][sum] - 1 + p) % p);
  }
  return 0;
}
