#include <bits/stdc++.h>
using namespace std;
const int MD = (int)1e9 + 7;
int dp[105][2605];
int main() {
  dp[0][0] = 1;
  for (int i = 1; i <= 100; ++i) {
    for (int j = 0; j < 26; ++j) {
      for (int k = 0; k <= 26 * (i - 1); ++k) {
        dp[i][k + j] = (dp[i][k + j] + dp[i - 1][k]) % MD;
      }
    }
  }
  int d;
  scanf("%d", &d);
  while (d--) {
    static char s[105];
    scanf("%s", s);
    int sum = 0;
    int len = strlen(s);
    for (int i = 0; i < len; ++i) {
      sum += s[i] - 'a';
    }
    printf("%d\n", (dp[len][sum] + MD - 1) % MD);
  }
}
