#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFll = 2e18;
const int base1 = 239;
const int base2 = 179;
const long long mod = 1e9 + 7;
const double pi = 3.1415926;
int dp[2700][2700];
void solve() {
  dp[0][0] = 1;
  for (int i = 1; i < 2700; i++) {
    for (int k = 1; k <= i; k++) {
      for (int j = 1; j <= min(i, 26); j++)
        dp[i][k] = (dp[i][k] + dp[i - j][k - 1]) % mod;
    }
  }
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int sum = 0;
    for (char c : s) sum += c - 'a' + 1;
    cout << (dp[sum][s.size()] + mod - 1) % mod << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
