#include <bits/stdc++.h>
using namespace std;
long long res[111][26111];
void init(long long x) {
  res[0][0] = 1;
  for (long long i = 1; i <= 100 + 1; i++)
    for (long long j = 1; j <= 26 * 100 + 1; j++) {
      if (j < 26) {
        for (long long k = 1; k <= j; k++) res[i][j] += res[i - 1][j - k];
      }
      if (j >= 26) {
        for (long long k = 1; k <= 26; k++) res[i][j] += res[i - 1][j - k];
      }
      res[i][j] %= 1000000007;
    }
}
long long ans(long long first, long long second) { return res[first][second]; }
long long len(string a) { return a.size(); }
long long cur(string a) {
  long long n = a.size();
  long long rec = 0;
  for (long long c = 0; c < n; c++) rec += a[c];
  rec -= 96 * n;
  return rec;
}
long long t;
string s;
int main() {
  cin >> t;
  init(t);
  while (t > 0) {
    t--;
    cin >> s;
    cout << ans(len(s), cur(s)) - 1 << endl;
  }
  return 0;
  system("E.exe");
}
