#include <bits/stdc++.h>
using namespace std;
long long fac[2800], inv[2800];
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long temp = power(a, b / 2);
  temp = (temp * temp) % 1000000007;
  if (b % 2) temp = (temp * a) % 1000000007;
  return temp;
}
long long fact[2800], inverse[2800], fact_inverse[2800];
void call() {
  fact[0] = 1;
  inverse[0] = 1;
  inverse[1] = 1;
  fact_inverse[0] = 1;
  fact_inverse[1] = 1;
  for (long long i = 1; i < 2800; i++) fact[i] = (i * fact[i - 1]) % 1000000007;
  for (long long i = 2; i < 2800; i++) {
    inverse[i] = (1000000007 -
                  ((1000000007 / i) * inverse[1000000007 % i]) % 1000000007) %
                 1000000007;
    fact_inverse[i] = (inverse[i] * fact_inverse[i - 1]) % 1000000007;
  }
}
long long ncr(long long n, long long r) {
  long long ans =
      (fact[n] * ((fact_inverse[n - r] * fact_inverse[r]) % 1000000007)) %
      1000000007;
  return ans;
}
long long solve(long long p, long long n) {
  long long ans = 0;
  long long a[2] = {1, -1};
  for (int i = 0; i <= n; i++) {
    if (i * 26 > p)
      i = n + 1;
    else {
      long long temp = a[i % 2] * ncr(n, i);
      temp = (temp % 1000000007 + 1000000007) % 1000000007;
      ans = (ans + (temp * ncr(n + p - 26 * i - 1, p - 26 * i)) % 1000000007) %
            1000000007;
    }
  }
  return ans;
}
char ch[120];
int main() {
  call();
  int t;
  cin >> t;
  while (t--) {
    cin >> ch;
    long long n, sum = 0;
    n = strlen(ch);
    for (int i = 0; i < n; i++) sum = sum + ch[i] - 'a';
    long long ans = solve(sum, n);
    ans--;
    ans = (ans % 1000000007 + 1000000007) % 1000000007;
    cout << ans << endl;
  }
  return 0;
}
