#include <bits/stdc++.h>
using namespace std;
const int MAXn = 3000;
int c[MAXn + 2][MAXn + 2];
int main() {
  int t, delta = 1000 * 1000 * 1000 + 7;
  string s;
  for (int i = 0; i <= MAXn; i++) c[i][0] = c[i][i] = 1;
  for (int i = 1; i <= MAXn; i++)
    for (int j = 1; j < i; j++)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % delta;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> s;
    int sum = 0;
    for (int j = 0; j < (int)s.size(); j++) sum += s[j] - 'a';
    int ans = 0;
    for (int j = 0; j <= (int)s.size(); j++) {
      long long co = 1;
      if (j % 2) co *= -1;
      if (sum - j * 26 >= 0)
        co = (co *
              ((long long)c[(int)s.size()][j] *
               c[sum - j * 26 + (int)s.size() - 1][(int)s.size() - 1]) %
              delta) %
             delta;
      else
        co = 0;
      ans = (ans + co) % delta;
      if (ans < 0) ans += delta;
    }
    ans = (ans - 1) % delta;
    if (ans < 0) ans += delta;
    cout << ans << endl;
  }
  return 0;
}
