#include <bits/stdc++.h>
const int MAX_N = 101;
const int MOD = (int)1e9 + 7;
int n;
int dp[MAX_N][MAX_N * 26 + 1];
char text[MAX_N];
int main() {
  dp[0][0] = 1;
  for (int i = 0; i < MAX_N; ++i) {
    for (int j = 0; j <= 26 * i; ++j) {
      for (int k = 0; k < 26; ++k) {
        if (i + 1 < MAX_N && j + k < MAX_N * 26)
          dp[i + 1][j + k] = (dp[i + 1][j + k] + dp[i][j]) % MOD;
      }
    }
  }
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", text);
    int total = 0;
    for (int j = 0; text[j]; ++j) {
      total += text[j] - 'a';
    }
    printf("%d\n", dp[strlen(text)][total] - 1);
  }
  return 0;
}
