#include <bits/stdc++.h>
using namespace std;
int const MN = 200, MS = 3000, mod = 1e9 + 7;
int n, dp[MN][MS], sum, t;
string s;
int main() {
  dp[0][0] = 1;
  for (int i = 0; i < MN - 10; i++)
    for (int j = 0; j < MS - 100; j++)
      for (int k = 1; k <= 26; k++) (dp[i + 1][j + k] += dp[i][j]) %= mod;
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> s;
    n = s.size();
    sum = 0;
    for (int i = 0; i < n; i++) sum += s[i] - 'a' + 1;
    cout << dp[n][sum] - 1 << '\n';
  }
}
