#include <bits/stdc++.h>
using namespace std;
int f[3333][3333];
string s;
int n;
void solve() {
  f[0][0] = 1;
  for (int i = 1; i <= 100; i++) {
    for (int j = 0; j <= (i - 1) * 26; j++) {
      for (int k = 0; k < 26; k++) {
        f[i][j + k] = (f[i][j + k] + f[i - 1][j]) % (int)(1e9 + 7);
      }
    }
  }
}
int main() {
  int T;
  cin >> T;
  solve();
  while (T--) {
    cin >> s;
    int tmp = 0;
    for (int i = 0; i < s.length(); i++) {
      tmp += s[i] - 'a';
    }
    cout << f[s.length()][tmp] - 1 << endl;
  }
  return 0;
}
