#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int m[100][2501];
int solve(int total, int size) {
  memset(m, 0, sizeof(m));
  for (typeof(int(min(26, total + 1))) k = (0); k < (int(min(26, total + 1)));
       k++)
    m[0][k] = 1;
  int mlt = min(25, total);
  for (typeof(size) i = (1); i < (size); i++) {
    for (typeof(total + 1) k = (0); k < (total + 1); k++) {
      if (mlt + 26 < k) break;
      for (typeof(int(min(26, k + 1))) v = (0); v < (int(min(26, k + 1)));
           v++) {
        m[i][k] += m[i - 1][k - v];
        m[i][k] %= MOD;
      }
      if (m[i][k] != 0) mlt = k;
    }
  }
  return m[size - 1][total] - 1;
}
int main() {
  char word[1024];
  int t;
  scanf("%d", &t);
  solve(2500, 100);
  for (typeof(t) tc = (0); tc < (t); tc++) {
    scanf("%*[\r\n\t ]%s", word);
    int sum = 0;
    int size = 0;
    for (char* c = word; *c; c++) {
      sum += *c - 'a';
      size++;
    }
    int s = m[size - 1][sum] - 1;
    printf("%d\n", s);
  }
}
