#include <bits/stdc++.h>
using namespace std;
long long dp[12201][101];
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < 26; i++) dp[i + 'a'][1] = 1;
  int m;
  for (int j = 2; j < 101; j++) {
    for (int i = j * int('a'); i < int('z') * j + 1; i++) {
      m = 25;
      while (m >= 0) {
        if (dp[i - 97 - m][j - 1] && i - 97 - m >= 0) {
          dp[i][j] += dp[i - 97 - m][j - 1];
          dp[i][j] = dp[i][j] % 1000000007;
        }
        m--;
      }
    }
  }
  while (t--) {
    string s;
    cin >> s;
    int sa = 0;
    for (int i = 0; i < s.size(); i++) sa += s[i];
    int u = s.size();
    cout << (dp[sa][u] - 1) % 1000000007 << endl;
  }
  return 0;
}
