#include <bits/stdc++.h>
using namespace std;
const int N = 26;
const int MOD = 1000000007;
int i, j, k, t, n, sum;
string s;
int dp[200][3000];
char c[200];
int main() {
  dp[0][0] = 1;
  for (i = 1; i <= 100; i++)
    for (j = 1; j <= i * N; j++)
      for (k = 1; k <= 26; k++)
        if (k <= j) dp[i][j] = (dp[i][j] + dp[i - 1][j - k]) % MOD;
  scanf("%d\n", &t);
  for (i = 0; i < t; i++) {
    gets(c);
    s = c;
    n = s.size();
    sum = 0;
    for (j = 0; j < n; j++) sum += s[j] - 'a' + 1;
    printf("%d\n", dp[n][sum] - 1);
  }
  return 0;
}
