#include <bits/stdc++.h>
using namespace std;
const int MOD = (1e9 + 7);
int dp[111][2666];
char str[109];
int main() {
  memset(dp, 0, sizeof(0));
  dp[0][0] = 1;
  for (int i = (1); i <= (100); ++i)
    for (int j = 0; j < (2666); ++j)
      for (int x = (1); x <= (26); ++x)
        if (j >= x) dp[i][j] = (dp[i][j] + dp[i - 1][j - x]) % MOD;
  int test;
  cin >> test;
  while (test--) {
    cin >> str;
    int len = strlen(str);
    int sum = 0;
    for (int i = 0; i < (len); ++i) sum += (str[i] - 'a' + 1);
    cout << dp[len][sum] - 1 << endl;
  }
  return 0;
}
