#include <bits/stdc++.h>
const int MAXN = 10010;
const int mod = 1000000007;
int dp[110][3100];
inline void up(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
void init() {
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 1; i < 110; ++i) {
    for (int j = 0; j <= i * 26; ++j) {
      for (int k = 0; k < 26 && k <= j; ++k) {
        up(dp[i][j], dp[i - 1][j - k]);
      }
    }
  }
}
char s[1100];
int main() {
  int test;
  init();
  while (~scanf("%d", &test))
    while (test--) {
      scanf("%s", s);
      int sum(0), n = strlen(s);
      for (int i = 0; i < n; ++i) {
        sum += s[i] - 'a';
      }
      printf(" %d\n", (mod - 1 + dp[n][sum]) % mod);
    }
  return 0;
}
