#include <bits/stdc++.h>
using namespace std;
long long dp[32 * 128][128], mod = 1000000007, t;
string s;
int main() {
  dp[0][0] = 1;
  for (int v = 0; v < 32 * 128; v++) {
    for (int n = 1; n < 128; n++) {
      for (int j = 0; j < min(26, v + 1); j++) {
        dp[v][n] += dp[v - j][n - 1];
        dp[v][n] %= mod;
      }
    }
  }
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> s;
    int v = 0;
    for (int j = 0; j < s.size(); j++) {
      v += s[j] - 'a';
    }
    cout << (dp[v][s.size()] - 1 + mod) % mod << "\n";
  }
  return 0;
}
