#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, -1, 1};
const int N = 101;
const long long mod = 1e9 + 7LL;
long long addMod(long long a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
long long mulMod(long long a, long long b) { return (a * b) % mod; }
char s[N];
int n;
long long pd[4003][101];
short memo[4003][101];
long long func(int n, int k) {
  if (memo[n][k]) return pd[n][k];
  if (k == 0) return n == 0;
  long long ans = 0;
  for (int i = 0; i < min(n, 25) + 1; ++i)
    ans = addMod(ans, func(n - i, k - 1));
  memo[n][k] = 1;
  return pd[n][k] = ans;
}
int main() {
  int t;
  scanf("%d", &t);
  memset(memo, 0, sizeof memo);
  while (t--) {
    scanf(" %s", s);
    n = strlen(s);
    int val = 0;
    for (int i = 0; i < n; ++i) val += s[i] - 'a';
    printf("%lld\n", func(val, n) - 1);
  }
  return 0;
}
