#include <bits/stdc++.h>
using namespace std;
string s;
const long long M = 1000000007;
long long cou[120][4000];
int main() {
  memset(cou, 0, sizeof(cou));
  cou[0][0] = 1;
  for (int i = 0; i < 110; ++i) {
    for (int j = 0; j < 3000; ++j) {
      if (cou[i][j] > 0) {
        cou[i][j] %= M;
        for (int k = 0; k < 26; ++k) {
          cou[i + 1][j + k] += cou[i][j];
        }
      }
    }
  }
  int t;
  cin >> t;
  while (t--) {
    cin >> s;
    int n = s.length();
    int sum = 0;
    for (int i = 0; i < n; ++i) {
      sum += int(s[i] - 'a');
    }
    long long ans = (cou[n][sum] - 1LL + M) % M;
    cout << ans << endl;
  }
  return 0;
}
