#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
char s[210];
int ans[110][3000];
void Precalc() {
  ans[0][0] = 1;
  for (int i = 0; i < 105; i++)
    for (int j = 0; j < 3000 - 26; j++)
      for (int k = 0; k < 26; k++)
        if ((ans[i + 1][j + k] += ans[i][j]) >= MOD) ans[i + 1][j + k] -= MOD;
}
void solve() {
  gets(s);
  int sum = 0;
  for (int i = 0; s[i]; i++) sum += s[i] - 'a';
  int res = ans[strlen(s)][sum];
  if ((res -= 1) < 0) res += MOD;
  printf("%d\n", res);
}
int main() {
  Precalc();
  int t;
  gets(s);
  sscanf(s, "%d", &t);
  while (t-- > 0) solve();
  return 0;
}
