#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
long long int dp[101][26]={0};
//long long int dp[2][100001]={0};
int main()
{ ios::sync_with_stdio(false);
int t;
cin >> t;
while(t--){
string s;
cin >> s;
if(s.size()==1){
cout << "0" << endl;
continue;
}
for(int i=0;i<26;++i){
char a='a'+i;
if(s[1]>=a){
int b=s[1]-a;
int c=s[0]+b;
cout << c << endl;
if(c<='z'){
dp[2][i]=1;
}
else
dp[2][i]=0;
}
else{
int b=a-s[1];
int c=s[0]-b;
cout << c << endl;
if(c>='a')
dp[2][i]=1;
else
dp[2][i]=0;
}
}
for(int i=3;i<=s.size();++i){long long int g=0;
for(int j=0;j<26;++j){
g+=dp[i-1][j];
g=g%MOD;
}
long long int f=g;
for(int j=s[i-1]-'a';j<='z'-'a';++j){
dp[i][j]=g;
g=(g-dp[i-1][j-(s[i-1]-'a')]+MOD)%MOD;
}
for(int j=s[i-1]-'a'-1;j>=0;--j){
f=(f-dp[i-1][26+(j-s[i-1]+'a')]+MOD)%MOD;
dp[i][j]=f;
}
}
long long int ans=0;
for(int i=0;i<26;++i){
ans+=dp[s.size()][i];
ans=ans%MOD;
}
cout << (ans-1+MOD)%MOD << endl;
for(int i=2;i<=100;++i){
for(int j=0;j<26;++j)
dp[i][j]=0;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBNT0QgMTAwMDAwMDAwNwpsb25nIGxvbmcgaW50IGRwWzEwMV1bMjZdPXswfTsKCi8vbG9uZyBsb25nIGludCBkcFsyXVsxMDAwMDFdPXswfTsKaW50IG1haW4oKQp7ICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgaW50IHQ7CiAgICBjaW4gPj4gdDsKICAgIHdoaWxlKHQtLSl7CiAgICAgICAgc3RyaW5nIHM7CiAgICAgICAgY2luID4+IHM7CiAgICAgICAgaWYocy5zaXplKCk9PTEpewogICAgICAgICAgICBjb3V0IDw8ICIwIiA8PCBlbmRsOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CgogICAgICAgIGZvcihpbnQgaT0wO2k8MjY7KytpKXsKICAgICAgICAgICAgY2hhciBhPSdhJytpOwoKICAgICAgICAgICAgaWYoc1sxXT49YSl7CiAgICAgICAgICAgICAgICBpbnQgYj1zWzFdLWE7CiAgICAgICAgICAgICAgICBpbnQgYz1zWzBdK2I7CiAgICAgICAgICAgICAgICBjb3V0IDw8IGMgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGlmKGM8PSd6Jyl7CiAgICAgICAgICAgICAgICAgICAgZHBbMl1baV09MTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICBkcFsyXVtpXT0wOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2V7CiAgICAgICAgICAgICAgICBpbnQgYj1hLXNbMV07CiAgICAgICAgICAgICAgICBpbnQgYz1zWzBdLWI7CiAgICAgICAgICAgICAgICBjb3V0IDw8IGMgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGlmKGM+PSdhJykKICAgICAgICAgICAgICAgICAgICBkcFsyXVtpXT0xOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIGRwWzJdW2ldPTA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yKGludCBpPTM7aTw9cy5zaXplKCk7KytpKXtsb25nIGxvbmcgaW50IGc9MDsKICAgICAgICAgICAgZm9yKGludCBqPTA7ajwyNjsrK2opewogICAgICAgICAgICAgICAgZys9ZHBbaS0xXVtqXTsKICAgICAgICAgICAgICAgIGc9ZyVNT0Q7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbG9uZyBsb25nIGludCBmPWc7CiAgICAgICAgICAgIGZvcihpbnQgaj1zW2ktMV0tJ2EnO2o8PSd6Jy0nYSc7KytqKXsKICAgICAgICAgICAgICAgIGRwW2ldW2pdPWc7CiAgICAgICAgICAgICAgICBnPShnLWRwW2ktMV1bai0oc1tpLTFdLSdhJyldK01PRCklTU9EOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmb3IoaW50IGo9c1tpLTFdLSdhJy0xO2o+PTA7LS1qKXsKICAgICAgICAgICAgICAgIGY9KGYtZHBbaS0xXVsyNisoai1zW2ktMV0rJ2EnKV0rTU9EKSVNT0Q7CiAgICAgICAgICAgICAgICBkcFtpXVtqXT1mOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGxvbmcgbG9uZyBpbnQgYW5zPTA7CiAgICAgICAgZm9yKGludCBpPTA7aTwyNjsrK2kpewogICAgICAgICAgICBhbnMrPWRwW3Muc2l6ZSgpXVtpXTsKICAgICAgICAgICAgYW5zPWFucyVNT0Q7CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgKGFucy0xK01PRCklTU9EIDw8IGVuZGw7CiAgICAgICAgZm9yKGludCBpPTI7aTw9MTAwOysraSl7CiAgICAgICAgICAgIGZvcihpbnQgaj0wO2o8MjY7KytqKQogICAgICAgICAgICAgICAgZHBbaV1bal09MDsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gMDsKCgoKCgp9Cg==